Comparison of three serialization performance of PHP5.5
Json_encode,serialize,igbinary three kinds of serialization, before there have been related tests, PHP5.5 this aspect of the test is not, this test is based on PHP5.5, and test cases,
http://blog.csdn.net/hguisu/article/details/7651730
The test case is the same, just from this test on the home igbinary serialize test, as a comparison, you can refer to
http://www.ooso.net/archives/538
Operating Environment
PHP5.5 Memory 16G 8 Core 2.0GMHz
Performance & Space Size list
Use decimal Group test results
Json:156serialize:222igbinary_serialize:123json_encode:0.02264404296875json_decode:0.052916049957275serialize : 0.031183004379272unserialize:0.029985904693604igbinary serialize:0.024919986724854igbinary unSerialize: 0.019716024398804
Easy comparison put the previous PHP5.3 test results below (not tested before igbinary)
json:156serialize:222json_encode:0.1087498664856json_decode:0.12652111053467serialize:0. 041656017303467unserialize:0.040987968444824
Using large Array test results
Json:5350serialize:8590igbinary_serialize:2432json_encode:0.92639899253845json_decode:1.8222811222076serialize : 1.3030271530151unserialize:1.1492691040039igbinary serialize:0.95630598068237igbinary unSerialize: 0.82603001594543
Here are the previous results (not previously tested igbinary)
Json:5350serialize:8590json_encode:0.90479207038879json_decode:1.753741979599serialize : 1.3566699028015unserialize:1.3003630638123
Summary:
Data aspects:
1: After upgrading to PHP5.5, json,serialize,igbinary three ways after serialization, the size has not changed, indicating that the object structure of the three format has not changed, so you can seamlessly upgrade.
2: Occupy space, igbinary save obvious advantages, such as in JSON an array 5.4k size of data, serialize way to 8.6k, and use Igbinary way, only 2.4k, nearly 1/4 of the serialize way.
Performance aspects
1: In small data, the performance of both JSON and native serialize is higher than the PHP5.3 version, while the performance is degraded when processing large amounts of data.
2: In the serialization aspect, Json_encode performance is the best, followed by Igbinary, the two are similar, the worst for the native serialize, the native serialize performance consumption is about 1.4 times times the JSON and Igbinary way
3: Igbinary in the inverse sequence than the serialization process is faster, of course, but also the fastest, but this is also cost-fast, see the final considerations.
4: Overall performance comparison, the overall performance is the sum of serialization and deserialization, a simple comparison will find that JSON is the worst, followed by the native serialize, and then good for the ibinary way.
In General , Igbinary are the best choice both in terms of serialization performance and space consumption. But the use of igbinary is not without cost, in the test we found that when calling Igbinary_unserialize, passing illegal data, will cause the entire PHP process to die, the log
Child 19131 exited on signal one (SIGSEGV) after 1.844938 seconds from start 1.844938 seconds from start
It is estimated that igbinary, in order to improve performance, did not validate the relevant format when unserialize, causing the entire process to exit unexpectedly. In the use of Redis, we use the serialize_php method of serialization, in order to improve performance, reduce the waste of Redis space using igbinary_serialize mode, and then switch accidentally stepped on this pit, resulting in server response error, direct 502, Fortunately, in the daily environment.
http://www.bkjia.com/PHPjc/931650.html www.bkjia.com true http://www.bkjia.com/PHPjc/931650.html techarticle PHP5.5 Three kinds of serialization performance comparison json_encode,serialize,igbinary three kinds of serialization, before there have been related tests, PHP5.5 this aspect of the test is not, this test ...