Bug #74929 [Opn->Fbk]: mbstring functions version 7.1.1 are slow compared to 5.3 on Windows

From: Date: Sat, 22 Jul 2017 08:47:20 +0000
Subject: Bug #74929 [Opn->Fbk]: mbstring functions version 7.1.1 are slow compared to 5.3 on Windows
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210185@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74929&edit=1 ID: 74929 Updated by: ab@php.net Reported by: andxfiles at gmail dot com Summary: mbstring functions version 7.1.1 are slow compared to 5.3 on Windows -Status: Open +Status: Feedback Type: Bug Package: mbstring related Operating System: Windows PHP Version: 7.1.7 Block user comment: N Private report: N New Comment: Thanks for the report. Do you use a 64-bit build of PHP 7? If so, please compare with a 32-bit build. I basically can't reproduce such a big discrepancy, but otherwise it could be possible a 64-bit build would be slower a little bit. Thanks. Previous Comments: ------------------------------------------------------------------------ [2017-07-15 13:29:13] andxfiles at gmail dot com Description: ------------ PHP's 7.1.1 mb_ (multibyte) functions are ~60% slower compared to PHP 5.3. Example of such functions: mb_strlen, mb_stripos, mb_substr. This affects Windows only. On Linux they seem to be way faster compared to PHP 5.3 and there is no such issue. PHP's 7.1.1 installation was done via WebPI (IIS). Test script: --------------- <?php $starttime = microtime(true); for ($i=0; $i<100000; $i++) { $a = mb_strlen("fdsfdssdfoifjosdifjosdifjosdij:ά", "UTF-8"); } $finishtime = microtime(true); echo "mb_strlen: " . number_format($finishtime - $starttime, 4)*1000 ." milliseconds<br/>"; $starttime = microtime(true); for ($i=0; $i<100000; $i++) { $a = mb_stripos("fdsfdssdfoifjosdifjosdifjosdij:ά", "α", 0, "UTF-8"); } $finishtime = microtime(true); echo "mb_stripos: " . number_format($finishtime - $starttime, 4)*1000 ." milliseconds<br/>"; $starttime = microtime(true); for ($i=0; $i<100000; $i++) { $a = mb_substr("fdsfdssdfoifjosdifjosdifjosdij:ά", $i, 1, "UTF-8"); } $finishtime = microtime(true); echo "mb_substr: " . number_format($finishtime - $starttime, 4)*1000 ." milliseconds<br/>"; ?> Expected result: ---------------- php 5.3.28 mb_strlen: 250 milliseconds mb_stripos: 3078.1 milliseconds mb_substr: 281.3 milliseconds php 7.1.1 mb_strlen: 406.3 milliseconds mb_stripos: 4796.9 milliseconds mb_substr: 421.9 milliseconds ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74929&edit=1

« previous php.bugs (#210185) next »