Fix compare_benches.sh again

This commit is contained in:
Bodigrim 2023-02-18 20:21:45 +00:00
parent 10cbce7621
commit 86c39b61bd

View File

@ -10,7 +10,6 @@ compare_benches () {
NEW="$1"
shift
HEADREF=$(git rev-parse --verify HEAD)
OLDREF=$(git rev-parse --verify "$OLD")
NEWREF=$(git rev-parse --verify "$NEW")
@ -22,7 +21,7 @@ compare_benches () {
cabal run -v0 benchmarks -- --csv "$OLDCSV" "$@" && \
git checkout -q "$NEWREF" && \
cabal run -v0 benchmarks -- --baseline "$OLDCSV" --csv "$NEWCSV" "$@" && \
git checkout -q "$HEADREF" && \
git checkout -q "@{-2}" && \
awk 'BEGIN{FS=",";OFS=",";print "Name,'"$OLD"','"$NEW"',Ratio"}FNR==1{trueNF=NF;next}NF<trueNF{print "Benchmark names should not contain newlines";exit 1}FNR==NR{oldTime=$(NF-trueNF+2);NF-=trueNF-1;a[$0]=oldTime;next}{newTime=$(NF-trueNF+2);NF-=trueNF-1;print $0,a[$0],newTime,newTime/a[$0];gs+=log(newTime/a[$0]);gc++}END{if(gc>0)print "Geometric mean,,",exp(gs/gc)}' "$OLDCSV" "$NEWCSV" > "$OLDVSNEWCSV"
}