Re: stripslashes() improvements

From: Date: Thu, 10 Jun 2004 15:10:32 +0000
Subject: Re: stripslashes() improvements
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-10388@lists.php.net to get a copy of this message
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

« previous php.internals (#10388) next »