benchmark driver: Allow passing a second fish path to compare

[ci skip]
This commit is contained in:
Fabian Homborg 2020-09-21 19:52:00 +02:00
parent ef9c924960
commit 796d92b4e9

View file

@ -1,17 +1,29 @@
#!/bin/sh #!/bin/sh
if [ "$#" -ne 1 ]; then if [ "$#" -gt 2 -o "$#" -eq 0 ]; then
echo "Usage: driver.sh /path/to/fish" echo "Usage: driver.sh /path/to/fish [/path/to/other/fish]"
exit 1
fi fi
FISH_PATH=$1 FISH_PATH=$1
FISH2_PATH=$2
BENCHMARKS_DIR=$(dirname "$0")/benchmarks BENCHMARKS_DIR=$(dirname "$0")/benchmarks
for benchmark in "$BENCHMARKS_DIR"/*; do for benchmark in "$BENCHMARKS_DIR"/*; do
basename "$benchmark" basename "$benchmark"
[ -n "$FISH2_PATH" ] && echo "$FISH_PATH"
${FISH_PATH} --print-rusage-self "$benchmark" > /dev/null ${FISH_PATH} --print-rusage-self "$benchmark" > /dev/null
if [ -n "$FISH2_PATH" ]; then
echo "$FISH2_PATH"
${FISH2_PATH} --print-rusage-self "$benchmark" > /dev/null
fi
if command -v hyperfine >/dev/null 2>&1; then if command -v hyperfine >/dev/null 2>&1; then
hyperfine "${FISH_PATH} $benchmark > /dev/null" if [ -n "$FISH2_PATH" ]; then
hyperfine "${FISH_PATH} $benchmark > /dev/null" "${FISH2_PATH} $benchmark > /dev/null"
else
hyperfine "${FISH_PATH} $benchmark > /dev/null"
fi
fi fi
done done