Pyhon 2.x or 3.x, which is faster?

Chris Angelico rosuav at gmail.com
Mon Mar 7 20:23:50 EST 2016


On Tue, Mar 8, 2016 at 12:00 PM, BartC <bc at freeuk.com> wrote:
> Yes of course it does. As does 'being slow'. Take another microbenchmark:
>
> def whiletest():
> |   i=0
> |   while i<=100000000:
> |   |   i+=1
>
> whiletest()
>
> Python 2.7:  8.4 seconds
> Python 3.1: 12.5 seconds
> Python 3.4: 18.0 seconds
>
> Even if you don't care about speed, you must admit that there appears to be
> something peculiar going on here: why would 3.4 take more than twice as long
> as 2.7? What do they keep doing to 3.x to cripple it on each new version?

How do your benchmarks compare on this code:

pass

ChrisA



More information about the Python-list mailing list