Author elliot.gorokhovsky
Recipients elliot.gorokhovsky, mdk, tim.peters, vstinner
Date 2016-11-16.18:10:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479319817.13.0.19715726113.issue28685@psf.upfronthosting.co.za>
In-reply-to
Content
So thanks for pointing out that perf has a --compare_to option: it turns out I had calculated the times wrong! Specifically, I had used

(ref-dev)/ref

while I should have used

ref/dev

which is what perf --compare_to uses. Anyway, the actual times are even more incredible than I could have imagined! First, here's my benchmark script:

#!/bin/bash
rm ref.json dev.json 2> /dev/null
python-dev/python -m perf timeit -s "$1" "sorted(l)" --rigorous -o dev.json > /dev/null
python-ref/python -m perf timeit -s "$1" "sorted(l)" --rigorous -o ref.json > /dev/null
python-ref/python -m perf compare_to ref.json dev.json

And here are the results:

./bench.sh "import random; l=[random.uniform(-1,1) for _ in range(0,100)]"
Median +- std dev: [ref] 8.34 us +- 0.18 us -> [dev] 3.33 us +- 0.13 us: 2.50x faster

So it's 150% faster! (i.e. 150% + 100% = 250%). 150% faster sorting for floats!!! If we make them tuples, it's even more incredible:
Median +- std dev: [ref] 20.9 us +- 1.0 us -> [dev] 4.99 us +- 0.27 us: 4.19x faster

319% faster!!! And earlier, I had thought 75% was impressive... I mean, 319%!!! And again, this is an application that is directly useful: DEAP spends a great deal of time sorting tuples of floats, this will make their EAs run a lot faster.

"import random; l=[str(random.uniform(-1,1)) for _ in range(0,100)]"
Median +- std dev: [ref] 15.7 us +- 0.9 us -> [dev] 9.24 us +- 0.52 us: 1.70x faster

"import random; l=[int(random.uniform(-1,1)*2**15) for _ in range(0,100)]"
Median +- std dev: [ref] 8.59 us +- 0.19 us -> [dev] 4.35 us +- 0.13 us: 1.98x faster
History
Date User Action Args
2016-11-16 18:10:17elliot.gorokhovskysetrecipients: + elliot.gorokhovsky, tim.peters, vstinner, mdk
2016-11-16 18:10:17elliot.gorokhovskysetmessageid: <1479319817.13.0.19715726113.issue28685@psf.upfronthosting.co.za>
2016-11-16 18:10:17elliot.gorokhovskylinkissue28685 messages
2016-11-16 18:10:16elliot.gorokhovskycreate