#45265 [Ver]: stripos() very slow

From: Date: Sun, 10 Aug 2008 17:01:45 +0000
Subject: #45265 [Ver]: stripos() very slow
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-127863@lists.php.net to get a copy of this message
 ID:               45265
 Updated by:       nicos@php.net
 Reported By:      marc at phpmyadmin dot net
 Status:           Verified
 Bug Type:         Performance problem
 Operating System: win32 only
 PHP Version:      5.2CVS-2008-08-10
 New Comment:

It seems it's a php_strtolower() issue because we have the same problem
by replacing stripos to strtolower...

The problem occurs on Windows also with strtolower()...

71 seconds on Windows, 25s on linux...

Reproduce code:
$a = str_repeat('x', 100000);
for ($i = 0; $i < 10000; $i++) {
        $b = strtolower($a);
}



Previous Comments:
------------------------------------------------------------------------

[2008-06-13 17:44:20] marc at phpmyadmin dot net

Description:
------------
stripos() is very slow on Windows, about ten times slower than on
Linux. 

Reproduce code:
---------------
$a = str_repeat('x', 100000);
for ($i = 0; $i < 10000; $i++) {
        $b = stripos($a, 'y');
}


Expected result:
----------------
On Linux it takes about 3 secondes.

Actual result:
--------------
On Windows: 30 seconds


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45265&edit=1



Thread (9 messages)

« previous php.bugs (#127863) next »