Author david.lindquist
Recipients david.lindquist, docs@python, gdr@garethrees.org, larry, rhettinger
Date 2014-02-25.05:16:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393305411.04.0.513276484335.issue20727@psf.upfronthosting.co.za>
In-reply-to
Content
> other benchmarks show it to be more than twice as slow

Can you share the method you used to get those results? Here's what I did:

$ python -m timeit --number=1000000 --setup="from rr_mine import roundrobin" "its = ['ABC', 'D', 'EF']; list(roundrobin(*its))"
1000000 loops, best of 3: 6.59 usec per loop
$ python -m timeit --number=1000000 --setup="from rr_theirs import roundrobin" "its = ['ABC', 'D', 'EF']; list(roundrobin(*its))"
1000000 loops, best of 3: 14.4 usec per loop

Using your recommended iterables (reducing the number of executions so it completes in my lifetime), the results are much closer, but my version still edges out the original:

$ python -m timeit --number=10000 --setup="from rr_mine import roundrobin" "its = [range(100)] + [()] * 100; list(roundrobin(*its))"
10000 loops, best of 3: 641 usec per loop
$ python -m timeit --number=10000 --setup="from rr_theirs import roundrobin" "its = [range(100)] + [()] * 100; list(roundrobin(*its))"
10000 loops, best of 3: 699 usec per loop
History
Date User Action Args
2014-02-25 05:16:51david.lindquistsetrecipients: + david.lindquist, rhettinger, larry, docs@python, gdr@garethrees.org
2014-02-25 05:16:51david.lindquistsetmessageid: <1393305411.04.0.513276484335.issue20727@psf.upfronthosting.co.za>
2014-02-25 05:16:51david.lindquistlinkissue20727 messages
2014-02-25 05:16:50david.lindquistcreate