[pypy-commit] benchmarks default: Fix for runs that only end up doing 1 iteration (e.g. hexiom2 with --fast).

arigo noreply at buildbot.pypy.org
Wed May 1 11:16:22 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r209:f7abffc04667
Date: 2013-05-01 11:15 +0200
http://bitbucket.org/pypy/benchmarks/changeset/f7abffc04667/

Log:	Fix for runs that only end up doing 1 iteration (e.g. hexiom2 with
	--fast).

diff --git a/unladen_swallow/perf.py b/unladen_swallow/perf.py
--- a/unladen_swallow/perf.py
+++ b/unladen_swallow/perf.py
@@ -167,7 +167,10 @@
     """
     assert len(sample1) == len(sample2)
     error = PooledSampleVariance(sample1, sample2) / len(sample1)
-    return (avg(sample1) - avg(sample2)) / math.sqrt(error * 2)
+    try:
+        return (avg(sample1) - avg(sample2)) / math.sqrt(error * 2)
+    except ZeroDivisionError:
+        return 0.0
 
 
 def IsSignificant(sample1, sample2):


More information about the pypy-commit mailing list