summaryrefslogtreecommitdiff
path: root/bench/stats.py
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-17 10:14:24 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-17 10:14:24 -0800
commit67c5944b02d0dcabd8e928dbc997b41c03000b0b (patch)
tree56ab0e258f9bd2c8423f631f15d107aa21ca63a0 /bench/stats.py
parent3fa0714153aa2242868d29a0c6e2816e561fbfbd (diff)
Better benchmark.
'make bench' runs the program 20 times against a file composed of 10 copies of Pro Git (about 5MB in all). It then does statistics on the results. We run it with high priority to get more consistent timings.
Diffstat (limited to 'bench/stats.py')
-rw-r--r--bench/stats.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/bench/stats.py b/bench/stats.py
new file mode 100644
index 0000000..8e500e8
--- /dev/null
+++ b/bench/stats.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python3
+
+import sys
+import statistics
+
+values = [ float(x) for x in sys.stdin.readlines()]
+
+print("mean = %.4f, median = %.4f, stdev = %.4f, variance = %.4f" %
+ (statistics.mean(values), statistics.median(values),
+ statistics.stdev(values), statistics.variance(values)))
+