Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

delete_global_variable & session_unset

10 views
Skip to first unread message

Stanislav Malyshev

unread,
May 16, 2007, 3:15:04 PM5/16/07
to php-g...@lists.php.net
I recently noticed that session_unset in 5.2 (and probably in 6) uses
delete_global_variable which looks up global scope and then deletes
variable from it. Fine so far, but it does it in a loop - meaning it
looks for the global scope each time anew for each session variable!
Also it seems to go through all CVs every time, which seems to be a
waste of time too. Any reason not to do it this way:

1. Fetch the global scope
2. For each CV in the global scope, check if it should be deleted
against session hash (since we have hashes it should be quick).

This way instead of stack depth*number of CVs*number of session vars we
get only stack depth+number of CVs*hash lookup time. Which should be
much better. So anybody sees any reason not to do it?
--
Stanislav Malyshev, Zend Products Engineer
st...@zend.com http://www.zend.com/

Chris

unread,
May 16, 2007, 5:49:05 PM5/16/07
to Stanislav Malyshev, php-g...@lists.php.net

Best to ask the php-internals list - they write the C code that does all
of this work ;)

--
Postgresql & php tutorials
http://www.designmagick.com/

Stanislav Malyshev

unread,
May 16, 2007, 6:13:22 PM5/16/07
to Chris, php-g...@lists.php.net
> Best to ask the php-internals list - they write the C code that does all
> of this work ;)

Yeah, I know, clicked on wrong item, already resent there.

0 new messages