plot-bench.py (481B)
1 #!/usr/bin/env python3 2 # 3 # Usage: ./plot-bench.py datafile 4 # (where datafile is the output of benchmark.sh) 5 6 import matplotlib.pyplot as plt 7 import sys 8 9 def bench_file_to_lists(infile): 10 return [[float(entry) for entry in line.split('\t')[1:]] for line in infile.readlines()] 11 12 def plot_data(data): 13 fig = plt.figure() 14 ax = fig.add_axes([0,0,1,1]) 15 ax.violinplot(data) 16 plt.savefig("plot.svg") 17 18 filename = sys.argv[1] 19 20 plot_data(bench_file_to_lists(open(filename)))