Skip to content

Instantly share code, notes, and snippets.

@ajfriend
Last active September 6, 2020 21:05
Show Gist options
  • Save ajfriend/40e65e949bff016b1cbe87051252efa0 to your computer and use it in GitHub Desktop.
Save ajfriend/40e65e949bff016b1cbe87051252efa0 to your computer and use it in GitHub Desktop.
#!/bin/sh
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
make benchmarks > out.txt
import pandas as pd
def readout(name='out.txt', as_df=False):
lines = open(name).read()
lines = lines.replace('microseconds', '#')
lines = lines.split('\n')
lines = (l.strip() for l in lines)
lines = (l[3:] for l in lines if l[:3] == '-- ')
lines = (l.split('#')[0] for l in lines)
lines = (l.split(':') for l in lines)
out = [(name, float(val)) for name, val in lines]
out = sorted(out)
if as_df:
out = pd.DataFrame(out)
out.columns = ['name', 'ms']
return out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment