Bug #75521 [Com]: unserialize() >3x slower
| From: | sailormax at inbox dot lv | Date: | Wed, 15 Nov 2017 09:25:16 +0000 |
| Subject: | Bug #75521 [Com]: unserialize() >3x slower | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212596@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75521&edit=1
ID: 75521
Comment by: sailormax at inbox dot lv
Reported by: sailormax at inbox dot lv
Summary: unserialize() >3x slower
Status: Feedback
Type: Bug
Package: Performance problem
Operating System: Windows 10
PHP Version: 7.2.0RC6
Block user comment: N
Private report: N
New Comment:
Additional information: 7.1.11 also has this problem.
7.1.5 is much faster!
Previous Comments:
------------------------------------------------------------------------
[2017-11-15 09:21:11] sailormax at inbox dot lv
I tested on these builds:
http://windows.php.net/downloads/releases/php-7.1.11-nts-Win32-VC14-x64.zip
http://windows.php.net/downloads/qa/php-7.2.0RC6-nts-Win32-VC15-x64.zip
Windows + Nginx + PHP-FPM
Where I can download latest snapshot for Windows x64 non thread safe?
------------------------------------------------------------------------
[2017-11-14 19:18:15] ab@php.net
Thanks for the report. I've tried the snippet and actually don't see any slowdown, by
numbers here using current dev trees.
7.1: 0.38896012306213
7.2: 0.31357884407043
master: 0.1246612071991
Either it's something HW or environment specific :/ Perhaps you could check with the current
snapshots, it could be that something has changed since last RCs. Also be sure the builds you use
are of same bitness and thread safety.
Thanks.
------------------------------------------------------------------------
[2017-11-14 08:14:54] sailormax at inbox dot lv
Description:
------------
Difference in speed between 7.1 and 7.2 of unserialize() = >3x
In my test 0.8s vs 0.28s on my PC
Test script:
---------------
$structure = array(
0,
true,
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
cccccccccccccccccccccccccccccccc ddddddddddddddddddddddddddddddd",
[1, 2, 3, "aaaaaaaaaaaaaaaaabbbbbbbbbbbbbbccccccccccccccccccccccccc", false]
);
$encoded = serialize($structure);
$ts = microtime(true);
for ($i=0; $i<100000; $i++)
$structure = unserialize($encoded);
print (microtime(true) - $ts);
Expected result:
----------------
similar to results of PHP 7.1
Actual result:
--------------
slower >3x
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75521&edit=1