-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_bench.sh
More file actions
executable file
·65 lines (54 loc) · 1.89 KB
/
run_bench.sh
File metadata and controls
executable file
·65 lines (54 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
#
# run_bench.sh — sequential bench runner for the C++ binding.
#
# Drives the four canonical passes (Single +/-LockSeed, Triple
# +/-LockSeed) and emits one Go-bench-style line per case to stdout.
# Defaults match the cross-binding canonical: HMAC-BLAKE3 MAC,
# 1024-bit ITB key, 16 MiB CSPRNG-filled payload, ITB_BENCH_MIN_SEC=5.
#
# Usage:
# make bench && ./run_bench.sh
# ITB_BENCH_MIN_SEC=10 ./run_bench.sh # tighter confidence
# ITB_BENCH_FILTER='blake3' ./run_bench.sh # one primitive only
# ./run_bench.sh --wrapper-only # only the wrapper bench (skip Single/Triple/LockSeed)
set -eu
set -o pipefail
cd "$(dirname "$0")"
if [ ! -x bench/build/bench_single ] || [ ! -x bench/build/bench_triple ]; then
echo "bench binaries missing — run \`make bench\` first" >&2
exit 1
fi
export ITB_BENCH_MIN_SEC="${ITB_BENCH_MIN_SEC:-5}"
wrapper_only=0
case "${1:-}" in
--wrapper-only) wrapper_only=1;;
"") ;;
*) echo "unknown option: $1" >&2; exit 2;;
esac
run_pass() {
local label="$1"
local bin="$2"
shift 2
echo "==== ${label} ===="
"$bin" "$@"
}
if [ "$wrapper_only" -eq 1 ]; then
if [ ! -x bench/build/bench_wrapper ]; then
echo "bench_wrapper binary missing — run \`make bench\` first" >&2
exit 1
fi
unset ITB_LOCKSEED
run_pass "Wrapper only -- format-deniability" ./bench/build/bench_wrapper
exit 0
fi
# Pass 1: Single Ouroboros, no LockSeed.
unset ITB_LOCKSEED
run_pass "Single (no LockSeed)" ./bench/build/bench_single
# Pass 2: Single Ouroboros, LockSeed enabled.
ITB_LOCKSEED=1 run_pass "Single (LockSeed)" ./bench/build/bench_single
# Pass 3: Triple Ouroboros, no LockSeed.
unset ITB_LOCKSEED
run_pass "Triple (no LockSeed)" ./bench/build/bench_triple
# Pass 4: Triple Ouroboros, LockSeed enabled.
ITB_LOCKSEED=1 run_pass "Triple (LockSeed)" ./bench/build/bench_triple