homepage

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 gruszczy
Recipients daniel.urban, eric.smith, gruszczy, ncoghlan, rhettinger, stutzbach, terry.reedy
Date 2011年04月04日.21:07:17
SpamBayes Score 0.003927866
Marked as misclassified No
Message-id <1301951238.42.0.370079186754.issue11707@psf.upfronthosting.co.za>
In-reply-to
Content
Here are some example performance results:
def cmp(x, y):
 return y - x
 
sorted(range(1, 10000000), key=cmp_to_key(cmp))
'''
C version:
real	0m19.994s
user	0m8.053s
sys	0m1.044s
Python version:
real	0m28.825s
user	0m28.046s
sys	0m0.728s
'''
def cmp(x, y):
 x = int(x)
 y = int(y)
 return (x > y) - (y > x)
 
sorted([str(i) for i in reversed(range(1, 2000000))], key=cmp_to_key(cmp))
'''
Python version
real	0m15.930s
user	0m15.629s
sys	0m0.284s
C version
real	0m10.880s
user	0m10.585s
sys	0m0.284s
'''
There is some performance gain. I don't know however, if it's enough to use C version instead of Python, that's for Raymond to decide.
History
Date User Action Args
2011年04月04日 21:07:18gruszczysetrecipients: + gruszczy, rhettinger, terry.reedy, ncoghlan, eric.smith, stutzbach, daniel.urban
2011年04月04日 21:07:18gruszczysetmessageid: <1301951238.42.0.370079186754.issue11707@psf.upfronthosting.co.za>
2011年04月04日 21:07:17gruszczylinkissue11707 messages
2011年04月04日 21:07:17gruszczycreate

AltStyle によって変換されたページ (->オリジナル) /