Bug #77461 [NEW]: perfomance slowdown
| From: | legale dot legale at gmail dot com | Date: | Tue, 15 Jan 2019 13:58:29 +0000 |
| Subject: | Bug #77461 [NEW]: perfomance slowdown | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-218958@lists.php.net to get a copy of this message | ||
From: legale dot legale at gmail dot com
Operating system: linux
PHP version: 7.3.1
Package: mbstring related
Bug Type: Bug
Bug description:perfomance slowdown
Description:
------------
There is a problem with mbfl library functions. UTF-16, UTF-16BE,
UTF-16LE encodings are parsed by the slow path (variable width multibyte
encodings).
Test script:
---------------
<?php
function bmark()
{
$args = func_get_args();
$len = count($args);
if ($len < 3) {
trigger_error("At least 3 args expected. Only $len given.",
256);
return false;
}
$cnt = array_shift($args);
$fun = array_shift($args);
$start = microtime(true);
$i = 0;
while ($i < $cnt) {
$i++;
$res = call_user_func_array($fun, $args);
}
$end = microtime(true) - $start;
return $end;
}
$i = 1000;
$str32 = mb_convert_encoding(str_repeat("ÑÑÑока", $i),
"UTF-32",
"UTF-8");
$str16 = mb_convert_encoding(str_repeat("ÑÑÑока", $i),
"UTF-16",
"UTF-8");
echo "str16: " . bmark($i, "mb_substr", $str16, 0, null, "UTF-16") .
PHP_EOL;
echo "str32: " . bmark($i, "mb_substr", $str32, 0, null, "UTF-32") .
PHP_EOL;
?>
Expected result:
----------------
UTF-16 and UTF-32 parsing speed should be mostly the same.
Actual result:
--------------
str16: 0.13957190513611
str32: 0.026632070541382
--
Edit bug report at https://bugs.php.net/bug.php?id=77461&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77461&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77461&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77461&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77461&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77461&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77461&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77461&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77461&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77461&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77461&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77461&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77461&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77461&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77461&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77461&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77461&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77461&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77461&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77461&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77461&r=mysqlcfg