Re: [PHP-DEV] Unicode string iterator performance

2006-02-03 Thread Andrei Zmievski
That's still sequential, and not random access. -Andrei On Feb 2, 2006, at 11:29 PM, Stefan Walk wrote: I think the most common usage would be grabbing one or a few characters and then going to do something else... if that happens alot, it will look more like like "random" string access than

Re: [PHP-DEV] Unicode string iterator performance

2006-02-02 Thread Stefan Walk
Andrei Zmievski wrote: On Feb 2, 2006, at 5:21 PM, Ilia Alshanetsky wrote: The real test however would be random character access, rather then sequential scans from start to end :-). How often do you access random characters in a string vs. sequential scans? Which is the more likely scenari

Re: [PHP-DEV] Unicode string iterator performance

2006-02-02 Thread Andrei Zmievski
On Feb 2, 2006, at 5:21 PM, Ilia Alshanetsky wrote: The real test however would be random character access, rather then sequential scans from start to end :-). How often do you access random characters in a string vs. sequential scans? Which is the more likely scenario in PHP scripts? I th

Re: [PHP-DEV] Unicode string iterator performance

2006-02-02 Thread Ilia Alshanetsky
Andrei, You may see a better performance using the [] if you change your test code to: for ($x = 0; $x < 1; $x++) { $i = 0; while (isset($a[$i])) { $c = $a[$i++]; } } The real test however would be random character access, rather then sequential scans from start to end :-). Ilia A

Re: [PHP-DEV] Unicode string iterator performance

2006-02-02 Thread Andrei Zmievski
For yet another comparison, the [] operator test under PHP 4 gives 7.24410 s. - Andrei On Feb 2, 2006, at 4:45 PM, Andrei Zmievski wrote: You probably saw that I have committed initial implementation of TextIterator. The impetus for this is that direct indexing of Unicode strings via [] oper

[PHP-DEV] Unicode string iterator performance

2006-02-02 Thread Andrei Zmievski
You probably saw that I have committed initial implementation of TextIterator. The impetus for this is that direct indexing of Unicode strings via [] operator is slow, very slow, at least currently. The reason is that [] cannot simply perform random-offset indexing into UCHar* strings. It needs