Skip to content

Commit 52b2529

Browse files
committed
tests/bench: Time namedtuple field access.
That's higher than instance field access - behold the power of hashing.
1 parent c3602e1 commit 52b2529

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import bench
2+
from _collections import namedtuple
3+
4+
T = namedtuple("Tup", "num bar")
5+
6+
def test(num):
7+
t = T(20000000, 0)
8+
i = 0
9+
while i < t.num:
10+
i += 1
11+
12+
bench.run(test)

0 commit comments

Comments
 (0)