tests/bench: Add testcase for positional/kwargs to enumerate().
Inspired by discussion in #577. So, in this case of builtin function, passing args by keyword has less than 1% overhead.
This commit is contained in:
parent
2a05f05f44
commit
69cbec4afb
7
tests/bench/func_builtin-1-enum_pos.py
Normal file
7
tests/bench/func_builtin-1-enum_pos.py
Normal file
@ -0,0 +1,7 @@
|
||||
import bench
|
||||
|
||||
def test(num):
|
||||
for i in iter(range(num//20)):
|
||||
enumerate([1, 2], 1)
|
||||
|
||||
bench.run(test)
|
7
tests/bench/func_builtin-2-enum_kw.py
Normal file
7
tests/bench/func_builtin-2-enum_kw.py
Normal file
@ -0,0 +1,7 @@
|
||||
import bench
|
||||
|
||||
def test(num):
|
||||
for i in iter(range(num//20)):
|
||||
enumerate(iterable=[1, 2], start=1)
|
||||
|
||||
bench.run(test)
|
Loading…
x
Reference in New Issue
Block a user