Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29485 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63145 invoked by uid 1010); 16 May 2007 20:01:42 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 63130 invoked from network); 16 May 2007 20:01:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 May 2007 20:01:42 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.114 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.114 unknown Windows 2000 SP4, XP SP1 Received: from [63.205.162.114] ([63.205.162.114:56002] helo=us-ex1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 17/F1-41162-5236B464 for ; Wed, 16 May 2007 16:01:42 -0400 Received: from [127.0.0.1] ([192.168.16.109]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 16 May 2007 13:01:38 -0700 Message-ID: <464B631F.2080601@zend.com> Date: Wed, 16 May 2007 13:01:35 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: 'PHP Internals' Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 16 May 2007 20:01:38.0475 (UTC) FILETIME=[037E77B0:01C797F5] Subject: delete_global_variable & session_unset From: stas@zend.com (Stanislav Malyshev) /* Sorry if you see this email twice, I sent it to a wrong list initially. */ 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 stas@zend.com http://www.zend.com/