STINNER Victor added the comment:
I still see a difference between find and rfind, even if the different is low
(11%).
$ ./python -m timeit -s 's=ABC*33; a=((s+D)*500+s+E); b=s+E' 'a.find(b)'
1 loops, best of 3: 93.6 usec per loop
$ ./python -m timeit -s 's=ABC*33; a=(E+s+(D+s)*500);
Roundup Robot added the comment:
New changeset c5e2ea9e3aa7 by Victor Stinner in branch 'default':
Close #13126: Simplify FASTSEARCH() code to help the compiler to emit more
http://hg.python.org/cpython/rev/c5e2ea9e3aa7
--
nosy: +python-dev
resolution: - fixed
stage: patch review -
Serhiy Storchaka storch...@gmail.com added the comment:
I checked one example on a 32-bit system (you have a 64-bit?)), because I was
afraid pessimization because of a lack of registers. str.find() is faster than
str.rfind(), but the patch makes it even faster.
But I would like to see the
Antoine Pitrou pit...@free.fr added the comment:
But I would like to see the script and the results of benchmarking of
the 1/2/3/20-character ascii/ucs1/ucs2/ucs4-substring in ascii/ucs1
/ucs2/ucs4-string, in all possible combinations. May be, such benchmark
scripts already exist?
Serhiy Storchaka storch...@gmail.com added the comment:
stringbench (the tool which produced those results) now exists in
Tools/stringbench/stringbench.py.
Thank you, yesterday they were not.
--
___
Python tracker rep...@bugs.python.org
Serhiy Storchaka storch...@gmail.com added the comment:
I used stringbench and self-writen script (see issue13165) for comparison and
saw no convincing difference. The difference to str.find does not exceed
accidental deviations for other functions which are not affected by the patch.
Changes by Serhiy Storchaka storch...@gmail.com:
--
nosy: +storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13126
___
___
Python-bugs-list
Changes by Florent Xicluna florent.xicl...@gmail.com:
--
priority: low - normal
stage: - patch review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13126
___
Changes by Florent Xicluna florent.xicl...@gmail.com:
--
nosy: +flox
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13126
___
___
Python-bugs-list
New submission from Antoine Pitrou pit...@free.fr:
With some gcc versions, str.find() is slower than str.rfind():
- 11.22 0.0 s=ABC*33; ((s+D)*500+s+E).find(s+E) (*100)
- 4.560.0 s=ABC*33; ((s+D)*500+E+s).find(E+s) (*100)
- 6.710.0 s=ABC*33; (s+E) in
10 matches
Mail list logo