ID: 22492
Updated by: [EMAIL PROTECTED]
Reported By: benji at daystream dot com
-Status: Duplicate
+Status: Bogus
Bug Type: Performance problem
Operating System: OSX
PHP Version: 4.3.0
New Comment:
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.
Thank you for your interest in PHP.
See bug #6608
Previous Comments:
------------------------------------------------------------------------
[2003-03-01 13:09:38] [EMAIL PROTECTED]
I haven't reopened you previous bug due to the fact that
you dont have a replicateable testcase and my testcase
doesn't reproduce anything close to your result. This
should be tracked in 6608 (which I just posted to).
------------------------------------------------------------------------
[2003-03-01 13:02:12] benji at daystream dot com
This issue was opened previously and closed without resolution two and
a half years ago due to lack of feedback in bug #6608. I made a comment
there but I'm not sure if closed topics are seen, so I'm opening it
here. I apologize if I shouldnt have opened a new bug report.
I'm running on OSX with PHP 4.3.0. The performance with a large array
that uses sizeof() in a loop is very poor. It's abut 50X slower than it
should be.
The following takes 8-10 seconds:
for ($i=1;$i<=sizeof($spell);$i++) {
$sentence=str_replace($spell[$i][0],$spell[$i][1],$sentence);
}
Whereas the following takes only .18 seconds:
$end=sizeof($spell);
for ($i=1;$i<=$end;$i++) {
$sentence=str_replace($spell[$i][0],$spell[$i][1],$sentence);
}
Other notes that might help: the array is stored in a file accessed by
require_once(), and the loop is in a function that brings $spell in as
a global variable.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22492&edit=1