summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorscoder <none@none>2008-04-24 22:04:18 +0200
committerscoder <none@none>2008-04-24 22:04:18 +0200
commit21f7a740fd043d6722af5d8f59c96545d44839e5 (patch)
treec26669abdaa616a4fca69982852563892f6e782d /benchmark
parentf2f0527e720494cac36a09439b3c3d1a502facc7 (diff)
downloadpython-lxml-21f7a740fd043d6722af5d8f59c96545d44839e5.tar.gz
[svn r3586] r4056@delle: sbehnel | 2008-04-24 09:55:51 +0200
more reliable benchmark numbers --HG-- branch : trunk
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/benchbase.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/benchmark/benchbase.py b/benchmark/benchbase.py
index 253f16f2..1b4feff0 100644
--- a/benchmark/benchbase.py
+++ b/benchmark/benchbase.py
@@ -371,18 +371,18 @@ def runBench(suite, method_name, method_call, tree_set, tn, an,
tree_builders = [ suite.tree_builder(tree, tn, an, serial, children)
for tree in tree_set ]
- if no_change or serial:
- args = tuple([ build() for build in tree_builders ])
- else:
- args = ()
+ rebuild_trees = not no_change and not serial
+
+ args = tuple([ build() for build in tree_builders ])
+ method_call(*args) # run once to skip setup overhead
times = []
- gc.collect()
for i in range(3):
+ gc.collect()
gc.disable()
t = -1
for i in call_repeat:
- if not no_change and not serial:
+ if rebuild_trees:
args = [ build() for build in tree_builders ]
t_one_call = current_time()
method_call(*args)
@@ -393,9 +393,10 @@ def runBench(suite, method_name, method_call, tree_set, tn, an,
t = min(t, t_one_call)
times.append(1000.0 * t)
gc.enable()
- gc.collect()
- if not isinstance(args, tuple):
- del args
+ if rebuild_trees:
+ args = ()
+ args = ()
+ gc.collect()
return times
def runBenchmarks(benchmark_suites, benchmarks):