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
12
tests/bench/var-8-namedtuple-1st.py
Normal file
12
tests/bench/var-8-namedtuple-1st.py
Normal 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)
|
Loading…
Reference in New Issue
Block a user