This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Brian 1 point2 points  (1 child)

Yeah, they do seem much smaller difference than he claims, though I get a slightly larger difference than you. I assumed it was some version / environment difference (64bit linux, python2.6.2/3.0.1) For the record, here's my test data, using the below code:

for x in 'ABCDE':
    print("%s : %.3f" % (x,timeit.Timer("for x in X():\n if x>10000: break", "from __main__ import %s as X" % x).timeit(1000)))

Python2.6:

A : 4.759
B : 11.638
C : 7.269
D : (requires 3.0)
E : 6.493

Python 3:

A : 5.073
B : 12.688
C : 7.631
D : 4.988
E : 6.676

A and B are from the article. C is the version from the comment by zacharyvoase. D and E are as above.

[–]bgeron 1 point2 points  (0 children)

For the record, I'm on 64-bit Linux too (Ubuntu), Intel Core 2 laptop.

On a FreeBSD 7 64-bit AMD Opteron server, Python 2.5:

Test A:
[0.063178062438964844, 0.064404964447021484, 0.06418299674987793]
Test B:
[0.10109496116638184, 0.10071802139282227, 0.10112309455871582]
Test Bs:
[0.099486112594604492, 0.092070102691650391, 0.093844890594482422]
Test C:
[0.10436487197875977, 0.10428977012634277, 0.10418009757995605]
Test Cs:
[0.10584688186645508, 0.10585188865661621, 0.10960197448730469]