From 69cbec4afb3ac191334f0cfc5bfa14b2cdefea4c Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 7 May 2014 22:07:10 +0300 Subject: [PATCH] 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. --- tests/bench/func_builtin-1-enum_pos.py | 7 +++++++ tests/bench/func_builtin-2-enum_kw.py | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 tests/bench/func_builtin-1-enum_pos.py create mode 100644 tests/bench/func_builtin-2-enum_kw.py diff --git a/tests/bench/func_builtin-1-enum_pos.py b/tests/bench/func_builtin-1-enum_pos.py new file mode 100644 index 0000000000..20935164e8 --- /dev/null +++ b/tests/bench/func_builtin-1-enum_pos.py @@ -0,0 +1,7 @@ +import bench + +def test(num): + for i in iter(range(num//20)): + enumerate([1, 2], 1) + +bench.run(test) diff --git a/tests/bench/func_builtin-2-enum_kw.py b/tests/bench/func_builtin-2-enum_kw.py new file mode 100644 index 0000000000..6c5e44419c --- /dev/null +++ b/tests/bench/func_builtin-2-enum_kw.py @@ -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)