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 RichIsMyName
Recipients RichIsMyName, asmodai, ezio.melotti, loewis, petri.lehtinen, pitrou, scoder, vstinner
Date 2011-10-31.18:59:59
SpamBayes Score 0.00021137756
Marked as misclassified No
Message-id <1320087600.87.0.174575557963.issue13279@psf.upfronthosting.co.za>
In-reply-to
Content
Here's a test demonstrating the memcmp optimization effect:
-----------------------------------------------------------
more ~/PickTest5/Python/string_test3.py

a = []
b = []
c = []
d = []
for x in range(0,1000) :
    a.append("the quick brown fox"+str(x))
    b.append("the wuick brown fox"+str(x))
    c.append("the quick brown fox"+str(x))
    d.append("the wuick brown fox"+str(x))

count = 0
for x in range(0,200000) :
    if a==c : count += 1
    if a==c : count += 2
    if a==d : count += 3
    if b==c : count += 5
    if b==d : count += 7
    if c==d : count += 11

print(count)



---------------------------------------------------------------------

# plain Python 3.3  no memcmp, no UCS specialization 

% time ./python ~/PickTest5/Python/string_test3.py 
2000000
28.918u 0.014s 0:29.02 99.6%	0+0k 0+0io 0pf+0w


% setenv CFLAGS -fno-builtin-memcmp # (reconfigure and remake)


% time ./python ~/PickTest5/Python/string_test3.py
2000000
29.783u 0.017s 0:29.88 99.6%	0+0k 0+0io 0pf+0w


-------------------------------------------------------------------------
# Python 3.3 with memcmp optimizations and UCS2/4 specialization (no CFLAGS)

% time ./python ~/PickTest5/Python/string_test3.py
2000000
37.126u 0.046s 0:37.35 99.4%	0+0k 0+0io 0pf+0w


% setenv CFLAGS -fno-builtin-memcmp # (reconfigure and remake)

% time ./python ~/PickTest5/Python/string_test3.py
2000000
18.621u 0.013s 0:18.69 99.6%	0+0k 0+0io 0pf+0w



---------------------------------------------------------------------

Note we only really see the effect if we make sure that gcc
isn't emitting its "special" memcmp: that's why the -fno-builtin-memcmp
is SO important on gcc builds!
See http://www.picklingtools.com/study.pdf

I am currently working with Bob Arendt (a colleague who works
frequently with Fedora) to try to put the
-fno-builtin-memcmp in the .spec file for their Python
History
Date User Action Args
2011-10-31 19:00:01RichIsMyNamesetrecipients: + RichIsMyName, loewis, pitrou, scoder, vstinner, asmodai, ezio.melotti, petri.lehtinen
2011-10-31 19:00:00RichIsMyNamesetmessageid: <1320087600.87.0.174575557963.issue13279@psf.upfronthosting.co.za>
2011-10-31 19:00:00RichIsMyNamelinkissue13279 messages
2011-10-31 18:59:59RichIsMyNamecreate