Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,29 @@
set -euo pipefail

LIMIT=""
CONCURRENCY=""
EFFORT=""
MAX_ITERATIONS=""
OUT=""
NO_OUT=""
JSON=""
FAIL_ON_DRC=""

default_concurrency() {
getconf _NPROCESSORS_ONLN 2>/dev/null || nproc 2>/dev/null || echo 4
}

CONCURRENCY="${BENCHMARK_CONCURRENCY:-$(default_concurrency)}"

print_help() {
cat <<'EOH'
Usage:
./benchmark.sh [limit|all] [--effort N] [--max-iterations N] [--out PATH] [--json] [--fail-on-drc]
./benchmark.sh [--limit N|all] [--effort N] [--max-iterations N] [--out PATH] [--json] [--fail-on-drc]
./benchmark.sh [limit|all] [--concurrency N] [--effort N] [--max-iterations N] [--out PATH] [--json] [--fail-on-drc]
./benchmark.sh [--limit N|all] [--concurrency N] [--effort N] [--max-iterations N] [--out PATH] [--json] [--fail-on-drc]

Options:
--limit N|all Run first N dataset-drc14 samples, or all samples
--concurrency N Number of Bun workers, or "auto"
--effort N Solver effort value (default from TS script: 1)
--max-iterations N Override solver max iterations
--out PATH Write JSON benchmark report (default: benchmark-result.json)
Expand All @@ -31,6 +39,7 @@ Defaults:
Examples:
./benchmark.sh
./benchmark.sh 5
./benchmark.sh --limit all --concurrency auto
./benchmark.sh --limit all --effort 2
./benchmark.sh --limit 10 --max-iterations 100 --out tmp/drc14-result.json
EOH
Expand All @@ -51,6 +60,13 @@ while [ "$#" -gt 0 ]; do
LIMIT="${2:-}"
shift 2
;;
--concurrency|--concurrent|--concurent|--CONCURENT)
CONCURRENCY="${2:-}"
if [ "$CONCURRENCY" = "auto" ]; then
CONCURRENCY="$(default_concurrency)"
fi
shift 2
;;
--effort)
EFFORT="${2:-}"
shift 2
Expand Down Expand Up @@ -83,7 +99,7 @@ while [ "$#" -gt 0 ]; do
esac
done

CMD=(bun "scripts/benchmark-drc14.ts")
CMD=(bun "scripts/benchmark-drc14.ts" "--concurrency" "$CONCURRENCY")

if [ -n "${LIMIT}" ]; then
CMD+=("--limit" "${LIMIT}")
Expand Down
Loading
Loading