Got the testscript on that for me?
Sure, I tried to keep side effects out and hope that speed decrease isn´t create from variable var resolution ($dummy), but I don´t think that should take 60-100% (another dev I was in exchange with did also get around 100%).
Actually now an improvement comes into my mind, you could use eval() in both cases in _repeated_code_line_3, that should reduce the side effects further and make both line almost equivalent, if you want to I can start another benchmark test with that little modification.
// initialization (for both)
$array=range(0,2000);
shuffle($array);
settype($objec,'object');
foreach($array AS $nr=>$val) {
$prop='test_'.$nr;
$objec->$prop=$val; }
// init end
// case 1, array
for ($i=1;$i<=1000;$i++) {
$dummy='test_'.$i;
$array[$i]+$array[$i]+$array[$i]; }
// case 1 end
// case 2, object property
for ($i=1;$i<=1000;$i++) {
$dummy='test_'.$i;
$object->$dummy+$object->$dummy+$object->$dummy; }
// case 2 end
regards
regards
-- o----------0-¬---------O-·---¬----o---®-----o o O ° .
| http://www.kiffen.de | pRoteçt y0ur bRaín |0 O ° ¤ ° ·
0°·³°²'²³-¹'³´³°^°³~³²³°'³²²¨³²^³¹³²°²³`³º³°Þ ° o © ° . ·
| psychedelic experience | gott@kiffen.de | O ° o °
o-¬--o--0-----©-·--O-----o-----0-¤----------o 0 ° · ° . ¤ ·
--
o----------0-¬---------O-·---¬----o---®-----o o O ° .
| http://www.kiffen.de | pRoteçt y0ur bRaín |0 O ° ¤ °
·
0°·³°²'²³-¹'³´³°^°³~³²³°'³²²¨³²^³¹³²°²³`³º³°Þ °
o © ° . ·
| psychedelic experience | gott@kiffen.de | O ° o °
o-¬--o--0-----©-·--O-----o-----0-¤----------o 0 ° · ° . ¤ ·