Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:1974 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5846 invoked from network); 25 May 2003 02:19:08 -0000 Received: from unknown (HELO mailout08.sul.t-online.com) (194.25.134.20) by pb1.pair.com with SMTP; 25 May 2003 02:19:08 -0000 Received: from fwd04.sul.t-online.de by mailout08.sul.t-online.com with smtp id 19Jl6A-0002Bu-00; Sun, 25 May 2003 04:18:58 +0200 Received: from baumbart.marcus-boerger.de (520072483730-0001@[80.142.146.245]) by fwd04.sul.t-online.com with esmtp id 19Jl64-1WLySGC; Sun, 25 May 2003 04:18:52 +0200 Reply-to:marcus.boerger@post.rwth-aachen.de Message-ID: <5.1.0.14.2.20030525034121.03004628@mailbox.rwth-aachen.de> X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Sun, 25 May 2003 04:12:01 +0200 To: Zeev@zend.com,Sterling Hughes , George Schlossnagle Cc: internals@lists.php.net Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Sender: 520072483730-0001@t-dialin.net Subject: SPL and foreach Optimized From: marcus.boerger@t-online.de ((Marcus =?iso-8859-1?Q?B=F6rger?=)) Hi all, during saturday i've spent some time to optimize SPL. For my testcase it is now 3% faster then the compareable while code. If OPTIMIZED_ARRAY_CONSTRUCT is defined as in current CVS then the difference is about 3.5%. Looking at the profiling results on that .5% difference i was directed to the emalloc change posted earlier. This will bring some more % (hopefully >5%). SPL uses op1->u.EA.type as an info pointer (called spl_foreach_proxy) to keep track of its current index and cache the . This can also be used for normal foreach and make the array copying there obsolete, which also allows some more "code tricks" (as already requested/ bugged on bugs.php.net). Integrating SPL in the engine would also nearly completly drop the performance loss of the hooks which is less then 0.5% atm (foreach, array not measured yet). The optimization used with OPTIMIZED_ARRAY_CONSTRUCT could also be used for normal foreach. regards marcus -- ------------------->>> mailto:mail@marcus-boerger.de <<<------------------ "We are animals among animals, all children of matter, save that we are the more disarmed. But since, unlike animals, we know that we must die, let us prepare for that moment by enjoying the life that has been given us by chance and for chance." Umberto Eco, The island of the day before --------------------->>> http://marcus-boerger.de <<<---------------------