Skip to content
Myr

Add --sort-by option

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Serpent7776 · committed by David Peter · parent 836d173 · Browse files · 1 file+6 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−4 removed

  • other:+6 added−4 removed

1 file+6 added−4 removed

modified:scripts/plot_whisker.py+6 added-4 removed
13 unmodified lines
1415parser = argparse.ArgumentParser(description=__doc__)16parser.add_argument("file", help="JSON file with benchmark results")17parser.add_argument("--title", help="Plot Title")18parser.add_argument("--sort-by", choices=['median'], help="Sort method")19parser.add_argument(20 "--labels", help="Comma-separated list of entries for the plot legend"21)22parser.add_argument(
9 unmodified lines
32 labels = args.labels.split(",")33else:34 labels = [b["command"] for b in results]35times = [b["times"] for b in results]35medians = [b["median"] for b in results]3637if args.sort_by == 'median':38 medians = [b["median"] for b in results]37indices = sorted(range(len(labels)), key=lambda k: medians[k])38labels = [labels[i] for i in indices]39times = [times[i] for i in indices]39 indices = sorted(range(len(labels)), key=lambda k: medians[k])40 labels = [labels[i] for i in indices]41 times = [times[i] for i in indices]4243plt.figure(figsize=(10, 6), constrained_layout=True)44boxplot = plt.boxplot(times, vert=True, patch_artist=True)45cmap = plt.get_cmap("rainbow")
15 unmodified lines