circuitpython/tests/perf_bench/viper_call1a.py
Damien George 73fccf5967 tests/perf_bench: Add some viper performance benchmarks.
To test raw viper function call overhead: function entry, exit and
conversion of arguments to/from objects.
2019-06-28 16:30:01 +10:00

20 lines
340 B
Python

@micropython.viper
def f1a(x):
return x
@micropython.native
def call(r):
f = f1a
for _ in r:
f(1)
bm_params = {
(50, 10): (15000,),
(100, 10): (30000,),
(1000, 10): (300000,),
(5000, 10): (1500000,),
}
def bm_setup(params):
return lambda: call(range(params[0])), lambda: (params[0] // 1000, None)