php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #434 ".=" is very slow
Submitted: 1998-06-03 18:05 UTC Modified: 1998-06-03 20:10 UTC
From: sam at daemoninc dot com Assigned: rasmus (profile)
Status: Closed Package: Performance problem
PHP Version: 3.0 Release Candidate 5 OS: Solaris 2.5.1
Private report: No CVE-ID: None
 [1998-06-03 18:05 UTC] sam at daemoninc dot com
".=" operation seems to get slower and slower as string gets longer.
Maybe some linear operation is being done on the string each time.
Reproduce with:

set_time_limit(3000);
for ($i = 0; $i <= 100000; ++$i) {
    $o .= "x";
}
I control-C'ed this after 135 seconds of run time.

Similar perl code runs in about one second on the same system.
Perl code is:
for ($i = 0; $i < 100000; ++$i) {
    $o .= "x";
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-06-03 20:10 UTC] rasmus
This is unlikely to get fixed in 3.0.  We might be able to do something for 3.1.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Apr 05 11:01:23 2020 UTC