Re: Unicode string iterator performance
| From: | Christian Schneider | Date: | Fri, 03 Feb 2006 01:19:27 +0000 |
| Subject: | Re: Unicode string iterator performance | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-21775@lists.php.net to get a copy of this message | ||
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