tests/bench: Time namedtuple field access.

That's higher than instance field access - behold the power of hashing.
This commit is contained in:
Paul Sokolovsky 2014-05-07 18:14:48 +03:00
parent c3602e159c
commit 52b25293e2
1 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,12 @@
import bench
from _collections import namedtuple
T = namedtuple("Tup", "num bar")
def test(num):
t = T(20000000, 0)
i = 0
while i < t.num:
i += 1
bench.run(test)