php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75521 unserialize() >3x slower
Submitted: 2017-11-14 08:14 UTC Modified: 2017-11-14 19:18 UTC
From: sailormax at inbox dot lv Assigned:
Status: Feedback Package: Performance problem
PHP Version: 7.2.0RC6 OS: Windows 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sailormax at inbox dot lv
New email:
PHP Version: OS:

 

 [2017-11-14 08:14 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-11-14 16:43 UTC] cmb@php.net
-Package: *Data Exchange functions +Package: Performance problem
 [2017-11-14 19:18 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2017-11-14 19:18 UTC] 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-15 09:21 UTC] 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-15 09:25 UTC] sailormax at inbox dot lv
Additional information: 7.1.11 also has this problem.
7.1.5 is much faster!
 [2017-11-15 09:31 UTC] sailormax at inbox dot lv
Rechecked: the problem was appear in 7.1.10! (7.1.9 was fine)
 [2017-11-15 09:42 UTC] sailormax at inbox dot lv
latest snapshot of PHP 7.2 has same problem.
Tested this build: http://windows.php.net/downloads/snaps/php-7.2/r235d33a/php-7.2-nts-windows-vc15-x64-r235d33a.zip (11/15/2017  5:20 AM)
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC