The three serialization methods of json_encode, serialize, and igbinary have been tested before. There are no tests for PHP5.5 yet. This test is based on PHP5.5, and the test case is,
http: //blog.csdn.net/hguisu/article/details/7651730 The test cases of
are the same, but this test is based on the test of igbinary serialize at home. For comparison, you can refer to
http://www. ooso.net/archives/538
Running environment
PHP5.5 memory 16G 8 core 2.0GMHz
Performance& Space size list
Using small array test results
json :156 serialize :222 igbinary_serialize :123 json_encode :0.02264404296875 json_decode :0.052916049957275 serialize :0.031183004379272 unserialize :0.029985904693604 Igbinary Serialize: 0.024919986724854 Igbinary unSerialize: 0.019716024398804
For the convenience of comparison, the previous test results of PHP5.3 are placed below (igbinary has not been tested before)
json :156 serialize :222 json_encode :0.1087498664856 json_decode :0.12652111053467 serialize :0.041656017303467 unserialize :0.040987968444824
json :5350 serialize :8590 igbinary_serialize :2432 json_encode :0.92639899253845 json_decode :1.8222811222076 serialize :1.3030271530151 unserialize :1.1492691040039 Igbinary Serialize: 0.95630598068237 Igbinary unSerialize: 0.82603001594543
The following are the previous results (igbinary was not tested before)
json :5350 serialize :8590 json_encode :0.90479207038879 json_decode :1.753741979599 serialize :1.3566699028015 unserialize :1.3003630638123
Summary:
Data:
1: After upgrading to PHP5.5, after serializing in json, serialize, and igbinary, the size has not changed, indicating that the object structure of these three formats has not changed, so it can Seamless upgrades.
2: In terms of space usage, igbinary has obvious advantages in saving space. For example, in a json array of 5.4k data, the serialize method takes 8.6k, but using the igbinary method, it only takes 2.4k, which is almost 1/4 of the serialize method. .
Performance
1: When dealing with small data, the performance of json and native serialize has improved compared to the PHP5.3 version, but when processing large amounts of data, the performance has declined. .
2: In terms of serialization, json_encode has the best performance, followed by igbinary, which is almost the same. The worst is native serialize. The performance consumption of native serialize is about 1.4 times that of json and igbinary
3: In terms of deserialization, igbinary is faster than the serialization process, and of course it is the fastest, but this speed also comes at a cost, see the last note.
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 native serialize, and the best is ibinary.
Generally speaking, igbinary is the best choice in terms of serialization performance and space usage. However, using igbinary is not without cost. During 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 11 (SIGSEGV) after 1.844938 seconds from start 1.844938 seconds from start