Re: why should $_SESSION be slower than other arrays?

From: Date: Thu, 09 Sep 2004 13:47:42 +0000
Subject: Re: why should $_SESSION be slower than other arrays?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-196213@lists.php.net to get a copy of this message
From: "Aaron Voisine" <voisine@yahoo.com>
I read in the docs several comments that $_SESSION is slower that other arrays. One comment even had benchmarking info indicating it was about half as fast. I don't understand why this should be. Isn't $_SESSION just a normal super global array like any other, except that it get serialized and written to disk *once at the end* of a request? Why on earth would this impact the performance of reading and writing in the middle of a request? Is there some funkyness going on under the covers that I'm missing? Can it be made to work as I described?
Do you have links to these "docs"?? The following code gives me this: Normal $val: 9.4890594482422E-05 Session var: 1.1920928955078E-05 <?php function gt() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } session_start(); $s1 = gt(); $val['key'] = array('foo'); $e1 = gt(); $s2 = gt(); $_SESSION['key'] = array('foo'); $e2 = gt(); echo 'Normal $val: ' . ($e1 - $s1) . '<br />Session var: ' . ($e2-$s2); ?> ---John Holmes...

« previous php.general (#196213) next »