[development] Note that PHP arrays are fast
Dries Buytaert
dries.buytaert at gmail.com
Thu Apr 12 06:27:15 UTC 2007
On 11 Apr 2007, at 03:55, Karoly Negyesi wrote:
>> * modulo is slower than bitwise-and and I think that this was the
>> main culprit to the even/odd flip performance
>
> But the patch was a bugfix and the race was between
>
> $class = $class == 'even' ? 'odd' : 'even'
>
> $class = $flip[$class];
>
> Because the key is not reliable, so we must flip the class.
Yes, in that particular patch, the if-test would sometimes break
(depending on the input data). The patch fixed a bug, and the tiny
performance improvement was just a secondary effect.
--
Dries Buytaert :: http://www.buytaert.net/
More information about the development
mailing list