[Python-Dev] Re: Re: string find(substring) vs. substring in string (original) (raw)
Fredrik Lundh fredrik at pythonware.com
Thu Feb 17 21:21:38 CET 2005
- Previous message: [Python-Dev] Re: string find(substring) vs. substring in string
- Next message: [Python-Dev] [ python-Bugs-1124637 ] test_subprocess is far too slow (fwd)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Raymond Hettinger wrote:
> but refactoring the contains code to use findinternal 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
- Previous message: [Python-Dev] Re: string find(substring) vs. substring in string
- Next message: [Python-Dev] [ python-Bugs-1124637 ] test_subprocess is far too slow (fwd)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]