Hi,
this is not directly releated. I looked into addslashes yesterday and thought that it would be much better to scan the string 2 times. The first time to find out how much extra bytes one needs, and the second time to do the actual replacing. So we do not need to allocate and oversized block and do not need any kind of realloc. This realloc is an absolute performance killer.
My patch, which has to be cleaned had the following benchmark results
210000 x addslashes() on different strings (7 alternating strings)
PHP5 RC3 - standard 12,x seconds PHP5 RC3 - my patch 7,6 seconds
The performance boost was about 4,5 seconds which is more than 33%.
Stefan Esser
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php