Re: [PHP-DEV] Re: Unicode string iterator performance

2006-02-03 Thread Xuefer
On 2/4/06, Jessie Hernandez <[EMAIL PROTECTED]> wrote: > Hi Andrei, > > Pardon me for my ignorance, as I have not even looked at the Unicode > stuff, but based on what you wrote, what about always allocating two > UChars per codepoint? It would take a bit more space, but then > random-offset indexi

[PHP-DEV] Re: Unicode string iterator performance

2006-02-03 Thread Jessie Hernandez
Hi Andrei, Pardon me for my ignorance, as I have not even looked at the Unicode stuff, but based on what you wrote, what about always allocating two UChars per codepoint? It would take a bit more space, but then random-offset indexing is fast and easy (the codepoint would always start at "ind

Re: [PHP-DEV] Re: Unicode string iterator performance

2006-02-03 Thread Christian Schneider
First of all I was simply proposing a very generic concept without bothering about the implementation on purpose. If it's not feasible then simply ignore it. Marcus Boerger wrote: caching? There is nothing to cache. And even if we would do that we would make every string an object since we w

Re: [PHP-DEV] Re: Unicode string iterator performance

2006-02-03 Thread Marcus Boerger
Hello Christian, caching? There is nothing to cache. And even if we would do that we would make every string an object since we would need to invalidate the position cache on write operations. Also i agree with the others that most common usage would be accessing a few chars probably changing th

[PHP-DEV] Re: Unicode string iterator performance

2006-02-02 Thread 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

[PHP-DEV] Re: Unicode string iterator performance

2006-02-02 Thread 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 backwar