Bug #77461 [Opn->Csd]: perfomance slowdown
| From: | legale dot legale at gmail dot com | Date: | Tue, 15 Jan 2019 14:18:04 +0000 |
| Subject: | Bug #77461 [Opn->Csd]: perfomance slowdown | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218962@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77461&edit=1
ID: 77461
User updated by: legale dot legale at gmail dot com
Reported by: legale dot legale at gmail dot com
Summary: perfomance slowdown
-Status: Open
+Status: Closed
Type: Bug
Package: mbstring related
Operating System: linux
PHP Version: 7.3.1
Block user comment: N
Private report: N
New Comment:
Wrong report.
Previous Comments:
------------------------------------------------------------------------
[2019-01-15 13:58:29] legale dot legale at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=77461&edit=1