circuitpython/tests/internal_bench/var-6.2-instance-speciallookup.py
Anson Mansfield b9d6d6af4b tests/internal_bench/var: Benchmark descriptor access.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2025-07-29 10:08:53 +10:00

19 lines
276 B
Python

import bench
class Foo:
def __init__(self):
self.num = 20000000
def __getattr__(self, name): # just trigger the 'special lookups' flag on the class
pass
def test(num):
o = Foo()
i = 0
while i < o.num:
i += 1
bench.run(test)