Created
          April 2, 2018 12:18 
        
      - 
      
 - 
        
Save tonybaloney/4e8e45f9128e9eb6e4f36c73ba5e5574 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
tonybaloney created this gist
Apr 2, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ import argparse from pathlib import Path from perf._bench import BenchmarkSuite import seaborn as sns import pandas as pd sns.set(style="whitegrid") parser = argparse.ArgumentParser(description='Convert a list of benchmarks into a CSV') parser.add_argument('files', metavar='N', type=str, nargs='+', help='files to compare') args = parser.parse_args() benchmark_names = [] records = [] first = True for f in args.files: benchmark_suite = BenchmarkSuite.load(f) if first: # Initialise the dictionary keys to the benchmark names benchmark_names = benchmark_suite.get_benchmark_names() first = False bench_name = Path(benchmark_suite.filename).name for name in benchmark_names: try: benchmark = benchmark_suite.get_benchmark(name) if benchmark is not None: records.append({ 'test': name, 'runtime': bench_name.replace('.json', ''), 'stdev': benchmark.stdev(), 'mean': benchmark.mean(), 'median': benchmark.median() }) except KeyError: # Bonus benchmark! ignore. pass df = pd.DataFrame(records) for test in benchmark_names: # Draw a pointplot to show pulse as a function of three categorical factors g = sns.factorplot( x="runtime", y="mean", data=df[df['test'] == test], #capsize=.2, palette="YlGnBu_d", size=12, aspect=1, kind="bar") g.despine(left=True) g.savefig("png/{}-result.png".format(test))