Re: [Python-Dev] Re: string find(substring) vs. substring in string
but refactoring the contains code to use find_internal sounds like a good first step. any takers?
</F> I'm up for it.
Raymond Hettinger
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>
participants (2)
-
Fredrik Lundh -
Raymond Hettinger