ID: 50351 Updated by: dmi...@php.net Reported By: rlillack at yasni dot de -Status: Assigned +Status: Closed Bug Type: Scripting Engine problem Operating System: 64/32bit linux PHP Version: 5.3.1 Assigned To: dmitry New Comment:
This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2009-12-07 08:14:49] s...@php.net Automatic comment from SVN on behalf of dmitry Revision: http://svn.php.net/viewvc/?view=revision&revision=291807 Log: Fixed bug #50351 (performance regression handling objects, ten times slower in 5.3 than in 5.2. foreach statement should not initiate GC) ------------------------------------------------------------------------ [2009-12-02 12:10:51] dmi...@php.net The reason of slowdown is Garbage Collector. I'll take a look into it. ------------------------------------------------------------------------ [2009-12-02 09:59:09] rlillack at yasni dot de It has to do something with object allocation because the problem does NOT occur with this loop: foreach (range(1, 1000000) as $i) { $a []= array($i); } ------------------------------------------------------------------------ [2009-12-02 09:11:20] notarealemail at nodomain dot com Sorry, forgotten a benchmark: time: 0.90 secs, memory usage 219.38 MiB. (original loop, GC disabled) So the problem seems more related to foreach+array+garbage collector than class allocation ------------------------------------------------------------------------ [2009-12-02 08:59:11] j...@php.net Not exactly faster but better than with foreach(): [j...@localhost ~]$ php -d memory_limit=2G t.php time: 2.73 secs, memory usage 371.39 MiB. [j...@localhost ~]$ src/build/php_5_3/sapi/cli/php -d memory_limit=2G t.php time: 3.05 secs, memory usage 383.46 MiB. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/50351 -- Edit this bug report at http://bugs.php.net/?id=50351&edit=1