-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_bench.sh
More file actions
executable file
·60 lines (53 loc) · 2.27 KB
/
Copy pathrun_bench.sh
File metadata and controls
executable file
·60 lines (53 loc) · 2.27 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
#!/usr/bin/env bash
#
# run_bench.sh -- micro-benchmark runner for the C++ binding. Builds
# libitb.so + the C++ library via build.sh, then compiles and runs the
# benches/bench_*.cpp binaries (make bench): encrypt_message,
# encrypt_stream_pump, and encrypt_stream_one_shot throughput at
# 1 MiB / 16 MiB / 64 MiB.
#
# Usage:
# ./run_bench.sh
set -eu
set -o pipefail
cd "$(dirname "$0")"
./build.sh
# Go-runtime pacing defaults for bench-scale allocation churn; the
# `:-` form respects any override set by the caller. The bench mains
# apply the same caps programmatically.
export ITB_GOMEMLIMIT="${ITB_GOMEMLIMIT:-512MiB}"
export ITB_GOGC="${ITB_GOGC:-20}"
# Bench-shape defaults — match the root Go BENCH3.md pin so the
# throughput numbers are directly comparable to the shipped Go
# Encrypt3x{128,256,512}Cfg baseline. Override any of these before
# calling the script to change the shape.
export ITB_NONCE_BITS="${ITB_NONCE_BITS:-512}"
export ITB_KEY_BITS="${ITB_KEY_BITS:-1024}"
export ITB_WITH_PARALLAX="${ITB_WITH_PARALLAX:-false}"
export ITB_WITH_WRAPPER="${ITB_WITH_WRAPPER:-false}"
export ITB_INNER_HASH="${ITB_INNER_HASH:-areion512}"
export ITB_BENCH_MIN_SEC="${ITB_BENCH_MIN_SEC:-5}"
# ITB_WITH_MAC=true derives MAC/AEAD profile counterparts. When
# ITB_PROFILE is set explicitly by the caller, it wins over the
# derivation and applies to both shapes (expert override).
: "${ITB_WITH_MAC:=false}"
if [ -n "${ITB_PROFILE:-}" ]; then
ITB_MSG_PROFILE_DEFAULT="${ITB_PROFILE}"
ITB_STREAM_PROFILE_DEFAULT="${ITB_PROFILE}"
elif [ "${ITB_WITH_MAC}" = "true" ]; then
ITB_MSG_PROFILE_DEFAULT="singlemsg-triple-mac-v1"
ITB_STREAM_PROFILE_DEFAULT="streaming-aead-triple-mac-v1"
else
ITB_MSG_PROFILE_DEFAULT="singlemsg-triple-nomac-v1"
ITB_STREAM_PROFILE_DEFAULT="streaming-noaead-triple-v1"
fi
# Build every bench binary via make (no run), then invoke each with
# its shape-appropriate ITB_PROFILE so the two shapes can carry
# independent MAC / no-MAC profiles in a single script pass.
make benches/build/bench_message benches/build/bench_stream \
benches/build/bench_stream_one_shot
export ITB_PROFILE="${ITB_MSG_PROFILE_DEFAULT}"
./benches/build/bench_message
export ITB_PROFILE="${ITB_STREAM_PROFILE_DEFAULT}"
./benches/build/bench_stream
./benches/build/bench_stream_one_shot