Skip to content

Commit

Permalink
Throw together a hyperfine benchmark runner
Browse files Browse the repository at this point in the history
  • Loading branch information
rctcwyvrn committed Aug 22, 2020
1 parent 89bf7a5 commit 22bdce6
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 0 deletions.
20 changes: 20 additions & 0 deletions hyperfine_benchmarks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import glob
import subprocess
from datetime import date


today = date.today()
date = today.strftime("%m%d")
label = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip().decode('ascii')[:8]

print(f"Date: {date} | hash: {label}")
subprocess.call(["cargo", "build", "--release"])
for bench in glob.glob("test/benchmark/*"):
name = bench.split("/")[-1].split(".")[0]
print(f"Running hyperfine for {name} | {bench}")
code = subprocess.call(["hyperfine", "--export-csv", "tmp_res.csv", f"target/release/rlox {bench}"])
with open(f"results/hyperfine/{name}/res.csv", "a") as f:
line = open("tmp_res.csv").readlines()[1]
line = f"{date},{label}," + line
f.write(line)
subprocess.call(["rm", "tmp_res.csv"])
1 change: 1 addition & 0 deletions res_template.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
date,hash,command,mean,stddev,median,user,system,min,max
1 change: 1 addition & 0 deletions results/hyperfine/binary_trees/res.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
date,hash,command,mean,stddev,median,user,system,min,max
1 change: 1 addition & 0 deletions results/hyperfine/equality/res.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
date,hash,command,mean,stddev,median,user,system,min,max
1 change: 1 addition & 0 deletions results/hyperfine/fib/res.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
date,hash,command,mean,stddev,median,user,system,min,max
1 change: 1 addition & 0 deletions results/hyperfine/instantiation/res.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
date,hash,command,mean,stddev,median,user,system,min,max
1 change: 1 addition & 0 deletions results/hyperfine/invocation/res.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
date,hash,command,mean,stddev,median,user,system,min,max
1 change: 1 addition & 0 deletions results/hyperfine/method_call/res.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
date,hash,command,mean,stddev,median,user,system,min,max
1 change: 1 addition & 0 deletions results/hyperfine/properties/res.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
date,hash,command,mean,stddev,median,user,system,min,max
Binary file added results/hyperfine/results.ods
Binary file not shown.
1 change: 1 addition & 0 deletions results/hyperfine/string_equality/res.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
date,hash,command,mean,stddev,median,user,system,min,max
1 change: 1 addition & 0 deletions results/hyperfine/trees/res.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
date,hash,command,mean,stddev,median,user,system,min,max
1 change: 1 addition & 0 deletions results/hyperfine/zoo/res.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
date,hash,command,mean,stddev,median,user,system,min,max

0 comments on commit 22bdce6

Please sign in to comment.