From 0ede48e024f1536c6dd90e8b1dc3487f55b0f1e9 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sun, 25 Sep 2022 13:22:52 +0200 Subject: [PATCH] benchmarks: Do hyperfine first Helps with warmup --- benchmarks/driver.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/benchmarks/driver.sh b/benchmarks/driver.sh index 6ccf3e0bc..46891c880 100755 --- a/benchmarks/driver.sh +++ b/benchmarks/driver.sh @@ -21,6 +21,17 @@ quote() { for benchmark in "$BENCHMARKS_DIR"/*; do basename "$benchmark" + # If we have hyperfine, use it first to warm up the cache + if command -v hyperfine >/dev/null 2>&1; then + cmd1="$(quote "${FISH_PATH}") --no-config $(quote "$benchmark")" + if [ -n "$FISH2_PATH" ]; then + cmd2="$(quote "${FISH2_PATH}") --no-config $(quote "$benchmark")" + hyperfine --warmup 3 "$cmd1" "$cmd2" + else + hyperfine --warmup 3 "$cmd1" + fi + fi + [ -n "$FISH2_PATH" ] && echo "$FISH_PATH" "${FISH_PATH}" --print-rusage-self "$benchmark" > /dev/null if [ -n "$FISH2_PATH" ]; then @@ -28,14 +39,5 @@ for benchmark in "$BENCHMARKS_DIR"/*; do "${FISH2_PATH}" --print-rusage-self "$benchmark" > /dev/null fi - if command -v hyperfine >/dev/null 2>&1; then - cmd1="$(quote "${FISH_PATH}") --no-config $(quote "$benchmark")" - if [ -n "$FISH2_PATH" ]; then - cmd2="$(quote "${FISH2_PATH}") --no-config $(quote "$benchmark")" - hyperfine "$cmd1" "$cmd2" - else - hyperfine "$cmd1" - fi - fi done