summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-22 13:02:01 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-22 13:02:01 -0800
commit0bc5cd38d4387e2624b8c67db0b5e282fd486421 (patch)
tree2e2df49f0a292899bfdf2d832ee45a1f546bb450 /bench
parent36f6ab248ab8391bb6dbaab97e23010a9fb82ce8 (diff)
Revised benchmark procedure.
Now we take the difference of the time to process the input and the time to run with no input. This compensates for slow startup time in dynamic languages. See comments on 2dcef8a
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),