> 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 in IRC) to
> say this should go in.

    Well, actually, I would prefer to see a proper BNDM
    implementation in the tree.

    - character classes are handled for free
      (i.e. a case insensitive search does not take longer)

    - combining shift-and and automata is much faster than our
      current naive algorithm (I may say so, I wrote it years ago)

    - allows us to combine multiple patterns into one search (I
      have not studied that part of the paper yet). This would
      enable us to optimize the case where you pass arrays to
      str_replace.  Instead of scanning the "haystack" one time
      per replacement text, we would scan it only once.

    - Sascha

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to