diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bench/var-5-class-attr.py | 11 | ||||
-rw-r--r-- | tests/bench/var-6-instance-attr.py | 14 | ||||
-rw-r--r-- | tests/bench/var-7-instance-meth.py | 17 |
3 files changed, 42 insertions, 0 deletions
diff --git a/tests/bench/var-5-class-attr.py b/tests/bench/var-5-class-attr.py new file mode 100644 index 0000000000..02ae874ac2 --- /dev/null +++ b/tests/bench/var-5-class-attr.py @@ -0,0 +1,11 @@ +import bench + +class Foo: + num = 20000000 + +def test(num): + i = 0 + while i < Foo.num: + i += 1 + +bench.run(test) diff --git a/tests/bench/var-6-instance-attr.py b/tests/bench/var-6-instance-attr.py new file mode 100644 index 0000000000..787ed870fb --- /dev/null +++ b/tests/bench/var-6-instance-attr.py @@ -0,0 +1,14 @@ +import bench + +class Foo: + + def __init__(self): + 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-7-instance-meth.py b/tests/bench/var-7-instance-meth.py new file mode 100644 index 0000000000..f9d463f40a --- /dev/null +++ b/tests/bench/var-7-instance-meth.py @@ -0,0 +1,17 @@ +import bench + +class Foo: + + def __init__(self): + self._num = 20000000 + + def num(self): + return self._num + +def test(num): + o = Foo() + i = 0 + while i < o.num(): + i += 1 + +bench.run(test) |