tests/bench: Time namedtuple field access.
That's higher than instance field access - behold the power of hashing.
This commit is contained in:
parent
c3602e159c
commit
52b25293e2
|
@ -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)
|
Loading…
Reference in New Issue