Benchmark results: Go 0.5 against Rust 0.6
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+32
-15
@@ -5,9 +5,9 @@
|
||||
# RUNS=5 BIG_MB=2048 SMALL=5000 scripts/bench.sh
|
||||
#
|
||||
# For each implementation, in a fresh key and vault on the same filesystem:
|
||||
# add one BIG_MB file, get it back, add SMALL small files (1-16 KiB) as a
|
||||
# folder, list the catalogue (filler plus SMALL+1 records), and get one small
|
||||
# file. Each step is timed RUNS times (median, min, max), with peak RSS and
|
||||
# add one BIG_MB file, and add SMALL small files (1-16 KiB) as a folder, each
|
||||
# into a fresh vault; then, in one vault holding both, get the big file,
|
||||
# list the catalogue (filler plus SMALL+1 records), and get one small file. Each step is timed RUNS times (median, min, max), with peak RSS and
|
||||
# peak thread count. Every step includes unlocking the key (two Argon2id
|
||||
# runs). Both implementations fsync every object and record, so `add`
|
||||
# timings include durable writes. Page caches are warm: dropping them needs
|
||||
@@ -20,7 +20,7 @@ root=$PWD
|
||||
work=${1:-$root/target/bench}
|
||||
runs=${RUNS:-3}
|
||||
big_mb=${BIG_MB:-1024}
|
||||
small=${SMALL:-2000}
|
||||
small=${SMALL:-500}
|
||||
|
||||
mkdir -p -- "$work"
|
||||
work=$(cd -- "$work" && pwd -P)
|
||||
@@ -65,25 +65,42 @@ summarise() { # lines of "secs rss threads" -> median min max, max rss, max thre
|
||||
sort -n | awk '{t[NR]=$1; if($2>r)r=$2; if($3>th)th=$3} END {printf "%8.2f s (min %.2f, max %.2f) rss %6.0f MiB threads %d\n", t[int((NR+1)/2)], t[1], t[NR], r/1024, th}'
|
||||
}
|
||||
|
||||
fresh() { # fresh key and vault at $1
|
||||
rm -rf -- "$1"
|
||||
mkdir -p -- "$1"
|
||||
export VAULT_KEY=$1/key VAULT_DIR=$1/store
|
||||
"$bin" genkey 2>/dev/null
|
||||
"$bin" init 2>/dev/null
|
||||
}
|
||||
|
||||
for impl in go rust; do
|
||||
bin=$work/vault-$impl
|
||||
echo "== $impl ($(stat -c %s "$bin") bytes)"
|
||||
for step in add-big get-big add-small list get-small; do
|
||||
# Writes: a fresh vault for every run.
|
||||
for step in add-big add-small; do
|
||||
results=""
|
||||
for run in $(seq 1 "$runs"); do
|
||||
v=$work/run-$impl
|
||||
rm -rf -- "$v"
|
||||
mkdir -p -- "$v"
|
||||
export VAULT_KEY=$v/key VAULT_DIR=$v/store
|
||||
"$bin" genkey 2>/dev/null
|
||||
"$bin" init 2>/dev/null
|
||||
case $step in
|
||||
get-big | list | get-small) "$bin" add "$data/big" 2>/dev/null; "$bin" add "$data/small" 2>/dev/null ;;
|
||||
esac
|
||||
fresh "$work/run-$impl"
|
||||
case $step in
|
||||
add-big) r=$(measure "$bin" add "$data/big") ;;
|
||||
get-big) r=$(measure "$bin" get big -o "$v/big.out") ;;
|
||||
add-small) r=$(measure "$bin" add "$data/small") ;;
|
||||
esac
|
||||
results+="$r"$'\n'
|
||||
done
|
||||
printf ' %-10s ' "$step"
|
||||
printf '%s' "$results" | grep . | summarise
|
||||
done
|
||||
# Reads: one populated vault, read repeatedly.
|
||||
v=$work/run-$impl
|
||||
fresh "$v"
|
||||
"$bin" add "$data/big" 2>/dev/null
|
||||
"$bin" add "$data/small" 2>/dev/null
|
||||
for step in get-big list get-small; do
|
||||
results=""
|
||||
for run in $(seq 1 "$runs"); do
|
||||
rm -f -- "$v/big.out" "$v/small.out"
|
||||
case $step in
|
||||
get-big) r=$(measure "$bin" get big -o "$v/big.out") ;;
|
||||
list) r=$(measure "$bin" list) ;;
|
||||
get-small) r=$(measure "$bin" get "small/f$(printf "%0${#small}d" 1)" -o "$v/small.out") ;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user