On Wed, 29 Jan 2003, Sara Golemon wrote:
I've got an implementation put together, the patch for which can be
viewed at:
http://169.229.139.97/test/str_ireplace.diff.txt
After some comments on IRC, here's an alternate version to the above
patch. This second approach avoids creating
I suggest to check out
http://citeseer.nj.nec.com/navarro01fast.html
The presented BNDM algorithm is one of the fastest string
searching algorithm while being easy to implement. Its main
loop is faster than the naive str_replace implementation(*).
Check out a C test
On a related topic, the 'boyer' option of str_replace isn't even
documented. That alternate method of performing str_replaces look like
it's a bit more efficient (no benchmarkes atm) but I'm wondering if
there's a specific reasons why it wasn't documented yet.
The BM algorithm is
I'd tip my hat towards implementing it. Pollita has a good point on
consistency and for those who don't know regex's.
On Wed, 29 Jan 2003, Sara Golemon wrote:
I may be wrong since I haven't profiled this, but my understanding is
that str_replace is much faster than doing either of the regex
One last optimization to save memcpys when needle_len == str_len (thanks
again ilia):
Actual Patch:
http://169.229.139.97/test/str_ireplace.diff-5.txt
Resultant string.c for easy reading:
http://169.229.139.97/test/string-5.c
I've heard enough Ayes over Nays (here, in bugs.php.net, and