message: Summary statistics
diff: @@ -3,8 +3,14 @@ import json
  import sys
  import os
  import csv
  +import statistics
  +from collections import defaultdict
  -MODES = ['brili', 'brilift']
  +MODES = {
  + 'brili': 'brili ',
  + 'brilift-jit': 'brilift -j'
  +}
  +BASELINE = 'brili'
  def get_results(bench_files):
  @@ -14,8 +20,8 @@ def get_results(bench_files):
  bench, _ = os.path.basename(fn).split('.', 1)
  for res in bench_data["results"]:
  - for mode in MODES:
  - if mode in res['command']:
  + for mode, pat in MODES.items():
  + if pat in res['command']:
  break
  else:
  assert False, "unknown benchmark command"
  @@ -24,9 +30,12 @@ def get_results(bench_files):
  def summarize(bench_files):
  + means = defaultdict(dict)
  +
  writer = csv.DictWriter(sys.stdout, ['bench', 'mode', 'mean', 'stddev'])
  writer.writeheader()
  for bench, mode, res in get_results(bench_files):
  + means[bench][mode] = res['mean']
  writer.writerow({
  'bench': bench,
  'mode': mode,
  @@ -34,6 +43,21 @@ def summarize(bench_files):
  'stddev': res['stddev']
  })
  + speedups = {k: [] for k in MODES}
  + for bench, modes in means.items():
  + baseline = modes[BASELINE]
  + print(bench, file=sys.stderr, end=': ')
  + for mode in MODES:
  + speedup = baseline / modes[mode]
  + speedups[mode].append(speedup)
  + print('{} {:.2f}x'.format(mode, speedup), file=sys.stderr, end=' ')
  + print(file=sys.stderr)
  + for mode, speedup_list in speedups.items():
  + print('{}: {:.2f}x'.format(
  + mode,
  + statistics.harmonic_mean(speedup_list)
  + ), file=sys.stderr)
  +
  if __name__ == '__main__':
  summarize(sys.argv[1:])
  