Raymond Hettinger wrote:

> > but refactoring the contains code to use find_internal sounds like a good
> > first step. any takers?
>
> I'm up for it.

excellent!

just fyi, unless my benchmark is mistaken, the Unicode implementation has
the same problem:

    str in -> 25.8 µsec per loop
    unicode in -> 26.8 µsec per loop

    str.find() -> 6.73 µsec per loop
    unicode.find() -> 7.24 µsec per loop

oddly enough, if I change the target string so it doesn't contain any partial
matches at all, unicode.find() wins the race:

    str in -> 24.5 µsec per loop
    unicode in -> 24.6 µsec per loop

    str.find() -> 2.86 µsec per loop
    unicode.find() -> 2.16 µsec per loop

</F> 



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to