From: "Aaron Voisine" <[EMAIL PROTECTED]>

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...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to