New submission from Antoine Pitrou <pit...@free.fr>:

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

----------
components: Interpreter Core
messages: 145186
nosy: haypo, loewis, pitrou
priority: normal
severity: normal
status: open
title: speed up finding of one-character strings
type: performance
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13134>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to