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: 2018-06-24 09:33 UTC
From: sailormax at inbox dot lv Assigned:
Status: Re-Opened Package: Performance problem
PHP Version: 7.2.0RC6 OS: Windows 10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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)
 [2018-06-24 04:25 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2018-06-24 09:33 UTC] nikic@php.net
-Status: No Feedback +Status: Re-Opened
 [2018-06-24 09:33 UTC] nikic@php.net
Most likely caused by https://github.com/php/php-src/commit/6b2813c3a735af0cf66c5c921752b36f169be000, which is the only unserialize change in 7.1.10.

We might want to backport the parse_iv2 implementation from master, if this is really the cause of the regression.
 [2023-05-10 07:48 UTC] getbusiness678 at gmail dot com
Get Business Investment are sharing latest news about finance, loan, business, tax, trading, share market etc. More info to visit: (https://getbusinessinvestment.com)github.com
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC