News Feed

News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Michael Nitschinger:
Benchmarking Cache Transcoders in PHP
January 31, 2013 @ 11:31:01

Michael Nitschinger has written up a new post comparing a few different methods for serializing or translating objects to store them in a cache. In it, he compares the PHP serializer, the igbinary extension and translation to JSON.

Storing PHP objects (or simpler data types like arrays) in caches always requires some kind of transformation. You need a way of encoding/decoding data so that it can be stored and loaded properly. In most languages, this process is known as object serialization. PHP provides a mechanism for this out of the box, but in this article we'll also look at igbinary as a drop-in replacement for the default serializer. We also compare the results to object transcoding based on JSON, which is not really an object serialization mechanism but commonly used as a data chache structure which has its own benefits and drawbacks.

He goes through each of the three technologies and includes a snippet of code showing how they'd work in object translation. He also talks about things like the size of the result and the performance of each when the results are looped over. Based on the results of some of his "microbenchmarking" of each of the methods, igbinary came out on top, even faster than PHP's own serialize/unserialize.

0 comments voice your opinion now!
cache transcoder serialize translate object igbinary json

blog comments powered by Disqus

Similar Posts

Stoyan Stefanov's Blog: Fancy Formatting

Derick Rethans: DateTimeImmutable

Davey Shafik: Everything You Need to Know About OpCode Caches

Anthony Ferrara: A Followup To An Open Letter To PHP-FIG Using Plugins to Speed Up WordPress

Community Events

Don't see your event here?
Let us know!

opinion language interview framework programming laravel community symfony application list composer series example podcast project php7 api yii2 introduction part2

All content copyright, 2015 :: - Powered by the Solar PHP Framework