Skip to content

Instantly share code, notes, and snippets.

@marvinborner
Created October 16, 2024 16:20
Show Gist options
  • Select an option

  • Save marvinborner/f71e3fdf55548692c7eb7b8d348d4284 to your computer and use it in GitHub Desktop.

Select an option

Save marvinborner/f71e3fdf55548692c7eb7b8d348d4284 to your computer and use it in GitHub Desktop.
Effekt benchmarks stack size
#!/bin/env bash
set -e
backend="llvm"
i=0
while true; do
echo "now running $i"
log="benchmarks_${backend}_$i.log"
>"$log"
while read config; do
arr=($config)
file="examples/benchmarks/${arr[0]}.effekt"
printf "${arr[0]} ${arr[1]} " >>"$log"
effekt.sh --backend "$backend" "$file" -- "${arr[1]}" >>"$log" || true
done <"examples/benchmarks/config_llvm.txt"
read -n 1 -s -r -p "change stack size in rts.ll and run sbt install!"
i=$((i + 1))
done
#!/bin/env python3
import matplotlib.pyplot as plt
RANGE = range(-1, 24)
dat = {}
for i in RANGE:
f = open(f"benchmarks_llvm_{i}.log")
for l in [l.split(" ") for l in f.readlines()]:
if l[0] not in dat:
dat[l[0]] = []
dat[l[0]].append(int(l[2].strip()))
fig, ax = plt.subplots()
bottom = [0 for _ in RANGE]
line = [str(2 ** (n + 4)) if n != -1 else "MASTER" for n in RANGE]
for name, values in dat.items():
ax.bar(line, values, 0.5, label=name, bottom=bottom)
bottom = [sum(x) for x in zip(bottom, values)]
box = ax.get_position()
ax.set_position([box.x0, box.y0, box.width * 0.8, box.height])
ax.set_title("benchmarks in nanoseconds with stack size n")
ax.legend(loc="center left", bbox_to_anchor=(1, 0.5))
ax.set_xticks(line)
ax.set_xticklabels(line, rotation=90)
plt.show()
@marvinborner
Copy link
Author

Figure_1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment