igbinary/igbinary — Issue #10: Disable compact strings by default
Author: iliaal
Created: 2011-12-11 18:41:01+00:00
State: open

I've ran some benchmarks on sessions serialized with igbinary from a real application, the results are listed below. They demonstrate that while on larger sessions (comprised of large associated arrays) there is a significant degree of compression in general it costs quite a bit of speed. The loss of speed on serialization (happens on every request when it comes to session) is not offset by the occasional speed boost on serialization.

Here is the test data: (old = without compact strings, new = with compact strings, the initial From # to # shows the size change from no compact strings to compact strings).

From 434 > 367 old encode: 0.43777918815613 old decode: 0.40255808830261 new encode: 0.74510383605957 new decode: 0.53817105293274
From 1516 > 1102 old encode: 1.3682861328125 old decode: 1.4467549324036 new encode: 2.8959910869598 new decode: 1.3653020858765
From 1005 > 721 old encode: 0.90887308120728 old decode: 1.0433969497681 new encode: 1.8361489772797 new decode: 0.96458220481873
From 64 > 59 old encode: 0.088389873504639 old decode: 0.076754093170166 new encode: 0.11718106269836 new decode: 0.073863983154297
From 681 > 500 old encode: 0.26527309417725 old decode: 0.47075510025024 new encode: 0.7581570148468 new decode: 0.43284606933594
From 13893 > 7115 old encode: 15.592931032181 old decode: 13.492940187454 new encode: 23.684764862061 new decode: 12.10723900795
From 752 > 643 old encode: 0.59770798683167 old decode: 0.81122398376465 new encode: 1.4481751918793 new decode: 0.79566812515259
From 4159 > 2503 old encode: 4.0288801193237 old decode: 3.927120923996 new encode: 7.1425549983978 new decode: 3.5316751003265
From 8817 > 3417 old encode: 8.9867460727692 old decode: 8.037250995636 new encode: 13.409754991531 new decode: 6.6915891170502
From 12734 > 5073 old encode: 10.898164987564 old decode: 12.610286951065 new encode: 17.143709897995 new decode: 10.19451212883
From 325 > 303 old encode: 0.19622898101807 old decode: 0.3057849407196 new encode: 0.45587205886841 new decode: 0.2911548614502
From 283 > 275 old encode: 0.17006802558899 old decode: 0.23673415184021 new encode: 0.39666104316711 new decode: 0.23322415351868
From 362 > 332 old encode: 0.19127202033997 old decode: 0.32509684562683 new encode: 0.47151303291321 new decode: 0.30947613716125
From 1076 > 866 old encode: 0.90676093101501 old decode: 1.0802361965179 new encode: 2.1507880687714 new decode: 1.0376629829407
From 283 > 275 old encode: 0.17912483215332 old decode: 0.23519492149353 new encode: 0.40200209617615 new decode: 0.23168301582336
From 30728 > 7871 old encode: 32.828596830368 old decode: 50.609142065048 new encode: 41.81777381897 new decode: 43.732861042023
From 283 > 275 old encode: 0.17121601104736 old decode: 0.30580806732178 new encode: 0.38597893714905 new decode: 0.29722905158997
From 1226 > 987 old encode: 1.0988500118256 old decode: 1.8658471107483 new encode: 2.5113840103149 new decode: 1.7602348327637
From 1250 > 797 old encode: 1.1317219734192 old decode: 2.0165128707886 new encode: 2.4276919364929 new decode: 1.8299679756165
From 283 > 275 old encode: 0.17006707191467 old decode: 0.32045698165894 new encode: 0.39562106132507 new decode: 0.31448984146118
From 7556 > 3778 old encode: 6.8922259807587 old decode: 11.745548963547 new encode: 11.729313135147 new decode: 10.330348014832
From 283 > 275 old encode: 0.16686487197876 old decode: 0.31312108039856 new encode: 0.37903904914856 new decode: 0.30503988265991
From 29660 > 10080 old encode: 33.980862140656 old decode: 57.449378013611 new encode: 46.285292863846 new decode: 49.655082941055
From 1225 > 987 old encode: 1.0753638744354 old decode: 2.0150039196014 new encode: 2.4329309463501 new decode: 1.9223010540009
From 22871 > 6417 old encode: 21.786847829819 old decode: 41.39239692688 new encode: 29.925580024719 new decode: 34.73362493515
From 283 > 275 old encode: 0.16662502288818 old decode: 0.32241296768188 new encode: 0.38521099090576 new decode: 0.31973099708557
From 11558 > 5059 old encode: 11.732460975647 old decode: 20.557806968689 new encode: 17.51638007164 new decode: 18.051419019699
From 6749 > 2981 old encode: 6.9085450172424 old decode: 11.412868022919 new encode: 10.844768047333 new decode: 10.402987957001
From 720 > 610 old encode: 0.55155801773071 old decode: 1.2042849063873 new encode: 1.427031993866 new decode: 1.1639738082886