This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients loewis, pitrou, vstinner
Date 2011-10-08.20:29:03
SpamBayes Score 0.00092825893
Marked as misclassified No
Message-id <1318105744.0.0.664183527644.issue13134@psf.upfronthosting.co.za>
In-reply-to
Content
In stringlib/fastsearch, instead of using our own loops, we can use memchr() (and, if available, memrchr()) when looking for one-character strings. memchr() is generally quite optimized; on this Linux/glibc machine, I get speedups of 5x-10x:

./python -m timeit -s "large='a'*10000+'b'" "large.find('b')"
-> before: 10.5 usec per loop
-> after: 0.889 usec per loop

./python -m timeit -s "large='b'+'a'*10000" "large.rfind('b')"
-> before: 7.06 usec per loop
-> after: 1.94 usec per loop
History
Date User Action Args
2011-10-08 20:29:04pitrousetrecipients: + pitrou, loewis, vstinner
2011-10-08 20:29:04pitrousetmessageid: <1318105744.0.0.664183527644.issue13134@psf.upfronthosting.co.za>
2011-10-08 20:29:03pitroulinkissue13134 messages
2011-10-08 20:29:03pitroucreate