Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21775 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18549 invoked by uid 1010); 3 Feb 2006 01:19:52 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 18533 invoked from network); 3 Feb 2006 01:19:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2006 01:19:52 -0000 X-Host-Fingerprint: 195.226.6.9 darkcity.gna.ch Linux 2.4/2.6 Received: from ([195.226.6.9:60562] helo=darkcity.gna.ch) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 63/39-41770-6BFA2E34 for ; Thu, 02 Feb 2006 20:19:51 -0500 Received: from localhost (localhost [127.0.0.1]) by darkcity.gna.ch (Postfix) with ESMTP id 772186E84; Fri, 3 Feb 2006 02:19:46 +0100 (CET) Received: from unknown by localhost (amavisd-new, unix socket) id client-XX9fHKkP; Fri, 3 Feb 2006 02:19:41 +0100 (CET) Received: by darkcity.gna.ch (Postfix, from userid 65534) id 6B6FC6E19; Fri, 3 Feb 2006 02:19:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on darkcity.gna.ch X-Spam-Level: *** X-Spam-Status: No, score=3.3 required=5.0 tests=AWL,RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL autolearn=disabled version=3.1.0 Received: from [192.168.1.43] (217-162-175-14.dclient.hispeed.ch [217.162.175.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTP id 77BA46999; Fri, 3 Feb 2006 02:19:30 +0100 (CET) Message-ID: <43E2AF9F.60607@cschneid.com> Date: Fri, 03 Feb 2006 02:19:27 +0100 User-Agent: Thunderbird 1.5 (Macintosh/20051201) MIME-Version: 1.0 To: Andrei Zmievski Cc: PHP Developers Mailing List References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at gna.ch Subject: Re: Unicode string iterator performance From: cschneid@cschneid.com (Christian Schneider) Andrei Zmievski wrote: > I am not sure how we can optimize [] to be faster than the iterator > approach. Food for thought? You could cache the last position (PHP- and Unicode string index) and start from there. This assumes that most accesses are (more or less) sequential. If you can step backward as well as forward you could use the cached version for both directions but even if you can only go forward it would cover the most common case I guess. Very simple idea but maybe it helps, - Chris