Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41639 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83217 invoked from network); 4 Nov 2008 13:35:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Nov 2008 13:35:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=jared.williams@ntlworld.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jared.williams@ntlworld.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ntlworld.com designates 81.103.221.49 as permitted sender) X-PHP-List-Original-Sender: jared.williams@ntlworld.com X-Host-Fingerprint: 81.103.221.49 mtaout03-winn.ispmail.ntl.com Solaris 10 (beta) Received: from [81.103.221.49] ([81.103.221.49:29001] helo=mtaout03-winn.ispmail.ntl.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CF/57-47812-BBF40194 for ; Tue, 04 Nov 2008 08:35:56 -0500 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20081104133552.HVIZ1691.mtaout03-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com> for ; Tue, 4 Nov 2008 13:35:52 +0000 Received: from p2 ([82.0.125.123]) by aamtaout04-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20081104133552.DIUC22934.aamtaout04-winn.ispmail.ntl.com@p2> for ; Tue, 4 Nov 2008 13:35:52 +0000 To: Date: Tue, 4 Nov 2008 13:35:57 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: Ack+gkRNXzy7o7z3T4qnjMnqybbilw== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4325 Message-ID: <20081104133552.DIUC22934.aamtaout04-winn.ispmail.ntl.com@p2> X-Cloudmark-Analysis: v=1.0 c=1 a=YJysChv_5gmpH--JIesA:9 a=HTErir1qmYV6KbU9dgEXaRjGvqMA:4 a=UAYcVMrLiE8A:10 a=2P-UmASVEcsA:10 a=aFdSZ05Rf_QA:10 Subject: Re: [PHP-DEV] [RFC] Iteration tools From: jared.williams@ntlworld.com ("Jared Williams") "Marcus Boerger" wrote in message news:154582775.20081103164129@marcus-boerger.de... > Hello Ionut, > > some remarks about your proposal: > > 1) You can turn any array into a Traversable using > (Recursive)ArrayIterator. Though this solution is still slow. The issue is > that the c-level code needs to verify the current pointer every single time > it uses it and that means traversing the array from the beginning. That > said we might want to: > a) Optimize that for cases where we don't have to. Basically when nothing > else is pointing to the array (refcount==1) we know when the array can be > changed and do not have to verify it always. > b) provide a lower level array to traversable mechanism that operates on > the current pointer provided by the array itself. That way having no need > to verify that pointer at all. That would be nice. Just written some code todo a binary search on keys, using the ArrayIterator::seek(). It was either that or use array_keys() on potentially large array. Jared