summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
Diffstat (limited to 'bench')
-rw-r--r--bench/stats.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/bench/stats.py b/bench/stats.py
index 3298099..c244b41 100644
--- a/bench/stats.py
+++ b/bench/stats.py
@@ -3,7 +3,15 @@
import sys
import statistics
-values = [ float(x) for x in sys.stdin.readlines()]
+def pairs(l, n):
+ return zip(*[l[i::n] for i in range(n)])
+
+# data comes in pairs:
+# n - time for running the program with no input
+# m - time for running it with the benchmark input
+# we measure (m - n)
+
+values = [ float(y) - float(x) for (x,y) in pairs(sys.stdin.readlines(),2)]
print("mean = %.4f, median = %.4f, stdev = %.4f" %
(statistics.mean(values), statistics.median(values),