|  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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-11-14 08:14 UTC] sailormax at inbox dot lv
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(
		"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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-11-14 16:43 UTC]
-Package: *Data Exchange functions +Package: Performance problem
 [2017-11-14 19:18 UTC]
-Status: Open +Status: Feedback
 [2017-11-14 19:18 UTC]
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.

 [2017-11-15 09:21 UTC] sailormax at inbox dot lv
I tested on these builds:

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: (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]
-Status: No Feedback +Status: Re-Opened
 [2018-06-24 09:33 UTC]
Most likely caused by, 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: (
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 21:01:28 2024 UTC