[Python-Dev] New stringbench benchmark results

Victor Stinner victor.stinner at haypocalc.com
Fri Oct 7 21:46:15 CEST 2011


Le jeudi 6 octobre 2011 02:06:30, Victor Stinner a écrit :
> The rfind case is really strange: the code between Python 3.2 and 3.3 is
> exactly the same. Even in Python 3.2: rfind looks twice faster than find:
> 
> ("AB"*300+"C").find("BC") (*1000) : 1.21
> ("C"+"AB"*300).rfind("CA") (*1000) : 0.57

It looks to be a gcc bug: using attached patch (written by Antoine), str.find() 
is a little bit faster. With the patch, the function does the same memory 
access, but it generates a different machine code.

I don't know exactly the difference yet, but it may be related to the CMOVNE 
instruction (which looks to be slower than a classical conditional jump, JNE).

Victor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fastsearch_gcc_bug.patch
Type: text/x-patch
Size: 1431 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20111007/88c504c5/attachment.bin>


More information about the Python-Dev mailing list