diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bench/func_args-1.1-pos_1.py | 10 | ||||
| -rw-r--r-- | tests/bench/func_args-1.2-pos_3.py | 10 | ||||
| -rw-r--r-- | tests/bench/func_args-2-pos_default_2_of_3.py | 10 | ||||
| -rw-r--r-- | tests/bench/func_args-3.1-kw_1.py | 10 | ||||
| -rw-r--r-- | tests/bench/func_args-3.2-kw_3.py | 10 | ||||
| -rw-r--r-- | tests/bench/func_builtin-1-enum_pos.py | 7 | ||||
| -rw-r--r-- | tests/bench/func_builtin-2-enum_kw.py | 7 | ||||
| -rw-r--r-- | tests/bench/loop_count-5.1-while_down_ne_localvar.py | 8 | ||||
| -rw-r--r-- | tests/bench/var-6.1-instance-attr-5.py | 18 | ||||
| -rw-r--r-- | tests/bench/var-8-namedtuple-1st.py | 12 | ||||
| -rw-r--r-- | tests/bench/var-8.1-namedtuple-5th.py | 12 |
11 files changed, 114 insertions, 0 deletions
diff --git a/tests/bench/func_args-1.1-pos_1.py b/tests/bench/func_args-1.1-pos_1.py new file mode 100644 index 000000000..eee0ea828 --- /dev/null +++ b/tests/bench/func_args-1.1-pos_1.py @@ -0,0 +1,10 @@ +import bench + +def func(a): + pass + +def test(num): + for i in iter(range(num)): + func(i) + +bench.run(test) diff --git a/tests/bench/func_args-1.2-pos_3.py b/tests/bench/func_args-1.2-pos_3.py new file mode 100644 index 000000000..7e03ee2f8 --- /dev/null +++ b/tests/bench/func_args-1.2-pos_3.py @@ -0,0 +1,10 @@ +import bench + +def func(a, b, c): + pass + +def test(num): + for i in iter(range(num)): + func(i, i, i) + +bench.run(test) diff --git a/tests/bench/func_args-2-pos_default_2_of_3.py b/tests/bench/func_args-2-pos_default_2_of_3.py new file mode 100644 index 000000000..1fa0fbda5 --- /dev/null +++ b/tests/bench/func_args-2-pos_default_2_of_3.py @@ -0,0 +1,10 @@ +import bench + +def func(a, b=1, c=2): + pass + +def test(num): + for i in iter(range(num)): + func(i) + +bench.run(test) diff --git a/tests/bench/func_args-3.1-kw_1.py b/tests/bench/func_args-3.1-kw_1.py new file mode 100644 index 000000000..7bc81e5be --- /dev/null +++ b/tests/bench/func_args-3.1-kw_1.py @@ -0,0 +1,10 @@ +import bench + +def func(a): + pass + +def test(num): + for i in iter(range(num)): + func(a=i) + +bench.run(test) diff --git a/tests/bench/func_args-3.2-kw_3.py b/tests/bench/func_args-3.2-kw_3.py new file mode 100644 index 000000000..7f9510684 --- /dev/null +++ b/tests/bench/func_args-3.2-kw_3.py @@ -0,0 +1,10 @@ +import bench + +def func(a, b, c): + pass + +def test(num): + for i in iter(range(num)): + func(c=i, b=i, a=i) + +bench.run(test) 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 000000000..20935164e --- /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 000000000..6c5e44419 --- /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) diff --git a/tests/bench/loop_count-5.1-while_down_ne_localvar.py b/tests/bench/loop_count-5.1-while_down_ne_localvar.py new file mode 100644 index 000000000..96bdb9129 --- /dev/null +++ b/tests/bench/loop_count-5.1-while_down_ne_localvar.py @@ -0,0 +1,8 @@ +import bench + +def test(num): + zero = 0 + while num != zero: + num -= 1 + +bench.run(test) diff --git a/tests/bench/var-6.1-instance-attr-5.py b/tests/bench/var-6.1-instance-attr-5.py new file mode 100644 index 000000000..e8d338360 --- /dev/null +++ b/tests/bench/var-6.1-instance-attr-5.py @@ -0,0 +1,18 @@ +import bench + +class Foo: + + def __init__(self): + self.num1 = 0 + self.num2 = 0 + self.num3 = 0 + self.num4 = 0 + self.num = 20000000 + +def test(num): + o = Foo() + i = 0 + while i < o.num: + i += 1 + +bench.run(test) diff --git a/tests/bench/var-8-namedtuple-1st.py b/tests/bench/var-8-namedtuple-1st.py new file mode 100644 index 000000000..7c4099ac6 --- /dev/null +++ b/tests/bench/var-8-namedtuple-1st.py @@ -0,0 +1,12 @@ +import bench +from _collections import namedtuple + +T = namedtuple("Tup", "num bar") + +def test(num): + t = T(20000000, 0) + i = 0 + while i < t.num: + i += 1 + +bench.run(test) diff --git a/tests/bench/var-8.1-namedtuple-5th.py b/tests/bench/var-8.1-namedtuple-5th.py new file mode 100644 index 000000000..2cd6d15a0 --- /dev/null +++ b/tests/bench/var-8.1-namedtuple-5th.py @@ -0,0 +1,12 @@ +import bench +from _collections import namedtuple + +T = namedtuple("Tup", "foo1 foo2 foo3 foo4 num") + +def test(num): + t = T(0, 0, 0, 0, 20000000) + i = 0 + while i < t.num: + i += 1 + +bench.run(test) |
