diff-benchmarks.sh 648 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
#!/bin/bash

before="$1"
after="$2"

parse() {
    sed -n \
        -e 's/ *\t */\t/g' \
        -e '/^Benchmark/p' |
10 11 12 13
        awk 'BEGIN{print "{\"results\": ["} {print "  {\"name\": \"",$1,"\", \"time\": ",$3," },"} END{print "]}"}' OFS="" ORS=" "|
        sed -e 's/, ]/ ]/g' |
        jq '.results[] | {name: .name, time: .time }'

14 15 16 17 18 19 20 21 22 23
}

benchcmp "$1" "$2"

echo ""
echo "Result:"

{
    parse < "$1"
    parse < "$2"
24
} | jq -e -r -s 'group_by(.name)[] | {name: .[0].name, speedup: (.[0].time / .[1].time)} | select(.speedup < 0.75) | "\(.name)\t\(.speedup)x"'
25 26 27 28 29 30 31 32

if [[ $? -ne 4 ]]; then
    echo ""
    echo "FAIL"
    exit 1
else
    echo "PASS"
fi