[pypy-svn] r58342 - in pypy/build/benchmem: . benchmark testing
hpk at codespeak.net
hpk at codespeak.net
Mon Sep 22 21:58:07 CEST 2008
Author: hpk
Date: Mon Sep 22 21:58:06 2008
New Revision: 58342
Modified:
pypy/build/benchmem/benchmark/create_recursive_tuples.py
pypy/build/benchmem/benchmark/list_of_instances_with_ints.py
pypy/build/benchmem/benchmark/simple_linked_instances.py
pypy/build/benchmem/runbench.py
pypy/build/benchmem/testing/test_benchtool.py
Log:
simplify current benchmarks which mostly
measure the size of certain objects.
Modified: pypy/build/benchmem/benchmark/create_recursive_tuples.py
==============================================================================
--- pypy/build/benchmem/benchmark/create_recursive_tuples.py (original)
+++ pypy/build/benchmem/benchmark/create_recursive_tuples.py Mon Sep 22 21:58:06 2008
@@ -1,8 +1,5 @@
-
-def bench_create_recursive_tuples(checkpoint, iter1, iter2):
+def bench_create_recursive_tuples(checkpoint, iter1):
x = ()
for i in range(iter1):
- checkpoint()
- for j in range(iter2):
- x = (x,)
-
+ x = (x,)
+ checkpoint(collect=True)
Modified: pypy/build/benchmem/benchmark/list_of_instances_with_ints.py
==============================================================================
--- pypy/build/benchmem/benchmark/list_of_instances_with_ints.py (original)
+++ pypy/build/benchmem/benchmark/list_of_instances_with_ints.py Mon Sep 22 21:58:06 2008
@@ -1,12 +1,9 @@
-
class A(object):
- def __init__(self, x, y):
+ def __init__(self, x):
self.x = x
- self.y = y
-def bench_list_of_instances_with_ints(checkpoint, iter1, iter2):
+def bench_list_of_instances_with_int(checkpoint, iter1):
l = []
for i in range(iter1):
- checkpoint()
- for j in range(iter2):
- l.append(A(i, j))
+ l.append(A(i))
+ checkpoint(collect=True)
Modified: pypy/build/benchmem/benchmark/simple_linked_instances.py
==============================================================================
--- pypy/build/benchmem/benchmark/simple_linked_instances.py (original)
+++ pypy/build/benchmem/benchmark/simple_linked_instances.py Mon Sep 22 21:58:06 2008
@@ -2,9 +2,8 @@
def __init__(self, other):
self.other = other
-def bench_linked_list(checkpoint, iter1, iter2):
+def bench_linked_instances(checkpoint, iter1):
x = None
for i in range(iter1):
- checkpoint()
- for j in range(iter2):
- x = A(x)
+ x = A(x)
+ checkpoint(collect=True)
Modified: pypy/build/benchmem/runbench.py
==============================================================================
--- pypy/build/benchmem/runbench.py (original)
+++ pypy/build/benchmem/runbench.py Mon Sep 22 21:58:06 2008
@@ -36,12 +36,15 @@
arglist = ",".join(map(str, args))
source = py.code.Source(path.read(), """
+ import gc
def write(c):
sys.stdout.write(c)
sys.stdout.flush()
- def checkpoint():
+ def checkpoint(collect=False):
+ if collect:
+ gc.collect()
write("c")
sys.stdin.read(1)
if __name__ == "__main__":
@@ -212,5 +215,5 @@
raise SystemExit("could not find %r"% (executable))
runner = BenchRunner(executable, benchlog)
for name in names:
- runner.run_checkpointed_bench(name, (100, 1000))
+ runner.run_checkpointed_bench(name, (100000,))
print "bench results append to -->>>", benchlog
Modified: pypy/build/benchmem/testing/test_benchtool.py
==============================================================================
--- pypy/build/benchmem/testing/test_benchtool.py (original)
+++ pypy/build/benchmem/testing/test_benchtool.py Mon Sep 22 21:58:06 2008
@@ -38,11 +38,11 @@
assert len(benchresult.name2results) == 1
results = benchresult.name2results.values()[0]
assert len(results) == 1
- assert len(results[0].snapshots) == 10 + 2
+ assert len(results[0].snapshots) == 2 + 1
for path in runbench.benchmarkdir.listdir("*.py"):
if path.basename[0] != "_":
- yield checker, path, 10, 10
+ yield checker, path, 10
def test_log_mapping():
s = py.std.textwrap.dedent("""\
More information about the Pypy-commit
mailing list