Skip to content
Myr

plot_benchmark_results.py

This file

Path

scripts/plot_benchmark_results.py

28 lines · 801 bytes · Python

Last changed by

Add documentation to plot_benchmark_results scriptsharkdpbefore adoptiona4347a5

History of this file

Take it

1#!/usr/bin/python2#3# This script `hyperfine` benchmark results as a box and whisker plot.4#5# Quoting from the matplotlib documentation:6#     The box extends from the lower to upper quartile values of the data, with7#     a line at the median. The whiskers extend from the box to show the range8#     of the data. Flier points are those past the end of the whiskers.9#1011import argparse12import json13import matplotlib.pyplot as plt1415parser = argparse.ArgumentParser()16parser.add_argument("file", help="JSON file with benchmark results")17args = parser.parse_args()1819with open(args.file) as f:20    results = json.load(f)["results"]2122commands = [b["command"] for b in results]23times = [b["times"] for b in results]2425plt.boxplot(times, labels=commands)26plt.ylabel("Time [s]")27plt.ylim(0, None)28plt.show()