thiemowmde added a comment.
> does that not also happen when passing arrays around as method parameters?
Depends. You know, the idea is to avoid copies but there are always edge cases.
function myCount( &$array ) {
for ( $i = 0; $i < 1000; $i++ ) {
count( $array );
}
}
$array = range( 0, 1000 );
$time0 = microtime( true );
myCount( $array );
$time1 = microtime( true );
printf( "%d ms\n", ( $time1 - $time0 ) * 1000 );
This takes 50 ms on my PHP 5.3 machine. Now remove the `&` in the first line.
Now it takes 1 ms. This is significant, obviously caused by 1000 unwanted and
not needed COW.
TASK DETAIL
https://phabricator.wikimedia.org/T98124
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: thiemowmde
Cc: JanZerebecki, JeroenDeDauw, thiemowmde, Aklapper, Wikidata-bugs, aude
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs