[Python-3000] Please re-add __cmp__ to python 3000

David A. Wheeler dwheeler at dwheeler.com
Wed Oct 17 18:57:38 CEST 2007


I said:
> I did a test (see below), and the mixin using a simulated cmp took
> 50% MORE time to sort a list using Python 2.5 (see code below) than
> when __cmp__ is used directly (as you CAN do in Python 2.5).

Oops, I forgot to post the actual numbers. Here they are, on my box (your mileage will CERTAINLY vary):

$ ./cmptest2.py 
7.34321498871
10.9759318829

$ ./cmptest2.py 
7.30745196342
10.9110951424

$ ./cmptest2.py 
7.25755906105
10.9108018875

In each run, the first number is the # of seconds to do the sort, using __cmp__; the second is the number of seconds, using a mixin.  I ran it 3 times, and took the min of each.  Using the min() of each number, we have a mixin performance overhead of  (10.91-7.26)/7.26 = 50.3%

--- David A. Wheeler



More information about the Python-3000 mailing list