News Feed
Sections




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

DevShed: The Basics of Implementing Adapter Objects with PHP

Pavel Shevaev's Blog: A reliable way to serialize/unserialize objects in PHP

DevShed: Using Directory Iterators and MySQL with Adapter Objects with PHP

Stefan Mischook's Blog: PHP Classes and Objects video tutorial

Oracle Technology Network: Persisting PHP5 Objects in Oracle


Community Events





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


language threedevsandamaybe unittest interview refactor list community podcast code series laravel symfony2 framework testing install developer release opinion api introduction

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework