Bug #74929 [Com]: mbstring functions version 7.1.1 are slow compared to 5.3 on Windows

From: Date: Sat, 22 Jul 2017 10:45:42 +0000
Subject: Bug #74929 [Com]: 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-210187@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 Comment by: andxfiles at gmail dot com Reported by: andxfiles at gmail dot com Summary: mbstring functions version 7.1.1 are slow compared to 5.3 on Windows Status: Feedback Type: Bug Package: mbstring related Operating System: Windows PHP Version: 7.1.7 Block user comment: N Private report: N New Comment: In both cases I'm using 32bit versions of php. One case is php 5.3.28 and the other is 7.1.1. The OS is Windows, the problem does not seem to exist under Linux. Both versions are installed via Web Platform Installer from within IIS. Other people have been able to reproduce it: https://stackoverflow.com/questions/45028018/php-7-mb-multibyte-functions-are-60-slower-than-in-5-3-possibly-windows-on Previous Comments: ------------------------------------------------------------------------ [2017-07-22 08:47:18] ab@php.net 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. ------------------------------------------------------------------------ [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 (#210187) next »