1
1
mirror of https://github.com/mgree/ffs.git synced 2024-07-07 08:16:20 +03:00
ffs/run_bench.sh
Michael Greenberg b9c6644312
Lazy loading (#50)
Lazy implementation is now the default. Use `--eager` to force ffs to construct the entire filesystem on startup.

NB that lazy loading is not the same as lazy parsing. There's still plenty of savings left on the table.

There is some unwelcome code duplication in saving to accommodate type-level jiggery pokery.
2021-10-01 07:57:58 -07:00

65 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
set -e
TIMESTAMP=$(date +"%Y%m%d_%H:%M:%S")
NUM_RUNS_DEFAULT=10
usage() {
exec >&2
printf "Usage: %s [-n NUM_RUNS]\n\n" "$(basename $0)"
printf " -n NUM_RUNS the number of runs for each test case (defaults to $NUM_RUNS_DEFAULT)\n"
exit 2
}
ARGS=""
while getopts ":n:h" opt
do
case "$opt" in
(n) if [ $((OPTARG)) -le 0 ]
then
printf "NUM_RUNS must be a positive number; got '%s'\n\n" "$OPTARG"
usage
fi
ARGS="$ARGS -n $OPTARG"
;;
(h) usage
;;
(*) printf "Unrecognized argument '%s'\n\n" "$OPTARG"
usage
;;
esac
done
shift $((OPTIND - 1))
[ $# -eq 0 ] || usage
cd bench
mkdir ${TIMESTAMP}
./mk_micro.sh
MICRO_RAW=$(mktemp)
printf "BENCHMARKING LAZY MODE\n"
BENCH_LAZY="${TIMESTAMP}/lazy_bench.log"
./bench.sh $ARGS >"$BENCH_LAZY"
./bench.sh -d micro $ARGS >"$MICRO_RAW"
MICRO_LAZY="${TIMESTAMP}/lazy_micro.log"
./fixup_micro.sh "$MICRO_RAW" >"$MICRO_LAZY"
printf "BENCHMARKING EAGER MODE\n"
BENCH_EAGER="${TIMESTAMP}/eager_bench.log"
FFS_ARGS="--eager" ./bench.sh $ARGS >"$BENCH_EAGER"
FFS_ARGS="--eager" ./bench.sh -d micro $ARGS >"$MICRO_RAW"
MICRO_EAGER="${TIMESTAMP}/eager_micro.log"
./fixup_micro.sh "$MICRO_RAW" >"$MICRO_EAGER"
rm "$MICRO_RAW"
./generate_charts.R "$BENCH_LAZY" "$MICRO_LAZY"
./generate_charts.R "$BENCH_EAGER" "$MICRO_EAGER"