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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sam at daemoninc dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 09:01:27 2025 UTC