|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-12-01 12:53 UTC] rlillack at yasni dot de
Description:
------------
PHP 5.3 did indeed introduce many performance improvements, but we
spotted a rather hard regression with handling a large amount of
objects that are allocated at the same time.
Running the following test case on one of our web servers yield this
result with a vanilla build of 5.2.11:
time: 1.28 secs, memory usage 376.48 MiB.
and this with 5.3.1:
time: 13.44 secs, memory usage 400.62 MiB.
(command line in both cases: PREFIX/bin/php -d memory_limit=2G
testcase.php)
The regression at least since the PHP 5.3 release candidates.
Both were fresh build straight from the tarball, No extensions, etc.
Opcode caches do not help. --with-zend-vm does not help.
Reproduce code:
---------------
<?php
$start = microtime(TRUE);
$a = array();
foreach (range(1, 1000000) as $i) {
$a []= new StdClass;
}
printf("time: %s secs, memory usage %s MiB.\n",
number_format(microtime(TRUE) - $start, 2),
number_format(memory_get_usage() / 1024 / 1024, 2));
Expected result:
----------------
PHP 5.3.1 should not be any slower than 5.2.11 is. :)
Actual result:
--------------
PHP 5.3.1 is ten times slower in this test case.
One of our apps does only handle 1/4th queries/s with 5.3 on a
production server.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 11:00:02 2025 UTC |
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); }