ID:               45265
 Updated by:       [EMAIL PROTECTED]
 Reported By:      marc at phpmyadmin dot net
 Status:           Verified
 Bug Type:         Performance problem
 Operating System: win32 only
 PHP Version:      5.2CVS-2008-08-10
 Assigned To:      pajoye
 New Comment:

And according to
http://msdn.microsoft.com/en-us/library/8h19t214(VS.80).aspx _tolower's
Windows implentation isn't ANSI.


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

[2008-08-11 00:15:45] [EMAIL PROTECTED]

Nice work Pierre but according to MSDN and yourself, _tolower's Windows
implementation is clearly faster than tolower but has undefined results
if the character is not ASCII... And we can't rely on that... can we?

According to libc, tolower checks the locale too... And _lower on libc
is quite different than Windows's since the _tolower() function is
identical to tolower() except that c must be an upper-case letter.

So...

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

[2008-08-10 23:41:53] [EMAIL PROTECTED]

The problem is that the Windows API does check for the locale while
processing the string (isupper, islower used by tolower or toupper).

Using _tolower/_toupper only speed up the functions using it (as fast
or faster than linux). But it does not work for non ASCII input.

I have to check is libc does check for locale as well, if not, I will
happily use _tolower on windows too.

That being said, it may be used too in zend then. tolower is used
*many* times there.

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

[2008-08-10 17:01:44] [EMAIL PROTECTED]

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);
}


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

[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

Reply via email to