aboutsummaryrefslogtreecommitdiff
path: root/bench/stats.py
blob: c244b419f66624bd2d2d2d3cb028d1f65edabc22 (plain)
  1. #!/usr/bin/env python3
  2. import sys
  3. import statistics
  4. def pairs(l, n):
  5. return zip(*[l[i::n] for i in range(n)])
  6. # data comes in pairs:
  7. # n - time for running the program with no input
  8. # m - time for running it with the benchmark input
  9. # we measure (m - n)
  10. values = [ float(y) - float(x) for (x,y) in pairs(sys.stdin.readlines(),2)]
  11. print("mean = %.4f, median = %.4f, stdev = %.4f" %
  12. (statistics.mean(values), statistics.median(values),
  13. statistics.stdev(values)))