? Set_time_limit (50); $a = array (1,2,3); $b = Array (' A ' =>1, ' B ' =>2, ' C ' =>3); $c = Array (' A ' =>array (1,2,3), ' B ' =>array (4,5,6)); $time 1 = microtime (true); $times = 1000000; #10w for ($i =1; $i <= $times; $i + +) { $A = Var_export ($a, true); } $time 2 = Microtime (true); for ($i =1; $i <= $times; $i + +) { $B = Var_export ($b, true); } $time 3 = Microtime (true); for ($i =1; $i <= $times; $i + +) { $C = Var_export ($c, true); } $time 4 = Microtime (true); for ($i =1; $i <= $times; $i + +) { $X = serialize ($a); } $time 5 = Microtime (true); for ($i =1; $i <= $times; $i + +) { $Y = serialize ($b); } $time 6 = Microtime (true); for ($i =1; $i <= $times; $i + +) { $Z = serialize ($c); } $time 7 = Microtime (true); for ($i =1; $i <= $times; $i + +) { $O = Unserialize ($X); } $time 8 = Microtime (true); for ($i =1; $i <= $times; $i + +) { $P = Unserialize ($Y); } $time 9 = Microtime (true); for ($i =1; $i <= $times; $i + +) { $Q = Unserialize ($Z); } $time = Microtime (true); $var _export_time[' a '] = $time 2-$time 1; $var _export_time[' b '] = $time 3-$time 2; $var _export_time[' c '] = $time 4-$time 3; $serialize _time[' a '] = $time 5-$time 4; $serialize _time[' b '] = $time 6-$time 5; $serialize _time[' c '] = $time 7-$time 6; $unserialize _time[' a '] = $time 8-$time 7; $unserialize _time[' b '] = $time 9-$time 8; $unserialize _time[' c '] = $time 10-$time 9; Print_r ($var _export_time); Print_r ($serialize _time); Print_r ($unserialize _time); ?> Output Array ([a] => 3.3401498794556 [b] => 5.1394801139832 [c] => 8.8483898639679) Array ([a] => 1.606370 9259033 [b] => 1.7033960819244 [c] => 3.4534389972687) Array ([a] => 1.6037359237671 [b] => 1.81780 3144455 [C] => 3.7992968559265) |