strtr() performance degradation

From: Date: Mon, 03 Jun 2013 08:55:16 +0000
Subject: strtr() performance degradation
Groups: php.internals 
Request: Send a blank email to internals+get-67610@lists.php.net to get a copy of this message
Hi Gustavo,

I didn't look into the code yet (and really don't like to do it), but we
just noticed terrible performance degradation of strtr() function between
5.4.11 and 5.4.15 coming probably after your changes.

$ cat strtr.php
<?php
function foo() {
    for ($i = 0; $i < 100000; $i++) {
        strtr("abcdefgh", array("a"=>"11",
"g"=>"22"));
    }
}
foo();

$ time sapi/cli/php.5.4.11 strtr.php

real    0m0.082s
user    0m0.071s
sys    0m0.010s

$ time sapi/cli/php.5.4.15 strtr.php

real    0m0.594s
user    0m0.584s
sys    0m0.007s


7 times slower :(

Could you place take a look.

Thanks. Dmitry.


Thread (23 messages)

« previous php.internals (#67610) next »