note 100602 added to function.serialize

From: Date: Tue, 26 Oct 2010 12:05:06 +0000
Subject: note 100602 added to function.serialize
Groups: php.notes 
Request: Send a blank email to php-notes+get-173463@lists.php.net to get a copy of this message
i did a benchmark between serialization and json_serialize and i found that serialize is 12% fast than json_encode (no tag, php 5.2.12). I used this array as a example of serialization (10'000 iterations) <? $arr=array( "in"=>array("in1"=>"valin1","in2"=>506,"in33"=>"valin3") ,"out"=>array("in1"=>"valin1","in2"=>"valin2")); ?> and unserialize is 70% fast than json_decode. in conclusion: a) as expected, serialize is the fast way to.. ahem, serialize objects and array (at least for some complex cases). b) but json produce a smaller string (and is more standard). ---- Server IP: 69.147.83.197 Probable Submitter: 200.83.2.4 ---- Manual Page -- http://www.php.net/manual/en/function.serialize.php Edit -- https://master.php.net/note/edit/100602 Del: integrated -- https://master.php.net/note/delete/100602/integrated Del: useless -- https://master.php.net/note/delete/100602/useless Del: bad code -- https://master.php.net/note/delete/100602/bad+code Del: spam -- https://master.php.net/note/delete/100602/spam Del: non-english -- https://master.php.net/note/delete/100602/non-english Del: in docs -- https://master.php.net/note/delete/100602/in+docs Del: other reasons-- https://master.php.net/note/delete/100602 Reject -- https://master.php.net/note/reject/100602 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#173463) next »