Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21777 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22098 invoked by uid 1010); 3 Feb 2006 01:27:05 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 22083 invoked from network); 3 Feb 2006 01:27:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2006 01:27:05 -0000 X-Host-Fingerprint: 216.145.54.171 mrout1.yahoo.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from ([216.145.54.171:39948] helo=mrout1.yahoo.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 3E/B9-41770-761B2E34 for ; Thu, 02 Feb 2006 20:27:04 -0500 Received: from [66.228.175.145] (borndress-lm.corp.yahoo.com [66.228.175.145]) by mrout1.yahoo.com (8.13.4/8.13.4/y.out) with ESMTP id k131MVBQ005581; Thu, 2 Feb 2006 17:22:31 -0800 (PST) In-Reply-To: <43E2AF9F.60607@cschneid.com> References: <43E2AF9F.60607@cschneid.com> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-ID: <4503b4d7d4469196100c878a3fcecc21@gravitonic.com> Content-Transfer-Encoding: 7bit Cc: PHP Developers Mailing List Date: Thu, 2 Feb 2006 17:23:51 -0800 To: Christian Schneider X-Mailer: Apple Mail (2.623) Subject: Re: Unicode string iterator performance From: andrei@gravitonic.com (Andrei Zmievski) Cache it where? In the zval or the opcode? What if the string changes? How do you detect that and invalidate the cached position? -Andrei On Feb 2, 2006, at 5:19 PM, Christian Schneider wrote: > 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