Message186251
| Author |
vstinner |
| Recipients |
flox, pitrou, serhiy.storchaka, vstinner |
| Date |
2013年04月07日.22:05:29 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1365372329.44.0.102305287698.issue13126@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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)'
10000 loops, best of 3: 93.6 usec per loop
$ ./python -m timeit -s 's="ABC"*33; a=("E"+s+("D"+s)*500); b="E"+s' 'a.rfind(b)'
10000 loops, best of 3: 84.3 usec per loop
Patched Python:
$ ./python -m timeit -s 's="ABC"*33; a=((s+"D")*500+s+"E"); b=s+"E"' 'a.find(b)'
10000 loops, best of 3: 84.7 usec per loop
$ ./python -m timeit -s 's="ABC"*33; a=("E"+s+("D"+s)*500); b="E"+s' 'a.rfind(b)'
10000 loops, best of 3: 84.5 usec per loop
I'm unable to explain why GCC (4.7 in my case) produces faster code with the patch, but the patch is simple and does not make the code (much) harder to understand.
So Antoine, please go ahead and apply it. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年04月07日 22:05:29 | vstinner | set | recipients:
+ vstinner, pitrou, flox, serhiy.storchaka |
| 2013年04月07日 22:05:29 | vstinner | set | messageid: <1365372329.44.0.102305287698.issue13126@psf.upfronthosting.co.za> |
| 2013年04月07日 22:05:29 | vstinner | link | issue13126 messages |
| 2013年04月07日 22:05:29 | vstinner | create |
|