micropython/tests/bench/var-8-namedtuple-1st.py
stijn 12340147b0 py: Use sequence of strings for named tuple initialization
- remove single string initialization style
- take list of strings instead
- store list in the type for fast lookup
2015-01-01 14:53:23 +02:00

13 lines
190 B
Python

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)