Re: Improve PHP 7 serialization
| From: | Rowan Collins | Date: | Tue, 23 Sep 2014 21:54:48 +0000 |
| Subject: | Re: Improve PHP 7 serialization | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-77556@lists.php.net to get a copy of this message | ||
On 23 September 2014 12:17:35 GMT+01:00, Park Framework <park.framework@gmail.com> wrote:
>Performance testing, Msgpack VS Igbinary
>
>igbinary: -20% slower, data size ~5%
>
As with any benchmark, the details of the test are rather important.
Firstly, some data structures may be better handled than others, or be targeted for extra
optimization, making some scenarios favour one method or the other. Some care needs to be taken in
simulating one or more realistic use-cases.
Secondly, speed to serialize and speed to unserialize are separate measures: igbinary openly admits
that it is best used for things like caching, where reading occurs more often than writing, as it is
often slower than text-based methods at write-time, but faster at read-time.
Thirdly, the algorithms may have optional features which trade speed for space, or affect the above
two points. For instance, igbinary's string interning, or the choice of structure used for
objects in a PHP msgpack implementation.
All that taken into account, it's unlikely that any one format is better in all situations, and
in some cases the existing text-based format may even have measurable advantages. Which points again
to the idea of making more algorithms available as bundled extensions, and as session serialization
methods, but not changing the meaning of existing functions.
--
Rowan Collins
[IMSoP]