Algorithm Optimizations - string search
| From: | Michal Dziemianko | Date: | Mon, 09 Jun 2008 11:39:24 +0000 |
| Subject: | Algorithm Optimizations - string search | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-38114@lists.php.net to get a copy of this message | ||
Hello,
Here: http://212.85.117.53/DIFF.txt is small patch that will speed up following functions:
strpos,
stripos,
strrpos
strripos,
and probably some others (all that use zend_memnstr/php_memnstr function)
The speedup of zend_memnstr is about 8% on average (about 30% in case of artificial strings).
Functions strrpos and strripos are about 25% faster on average.
The only drawback - it needs some additional space (size of the needle).
All functions pass all the tests.
If it looks fine than I will apply for cvs account.
Cheers,
Michal