refactor: move hyperfine call into fn, cleanup code

Also tried +short and -Q options for dig and drill,
but it only increased time. Anyway, now it's
more convenient to append options.
This commit is contained in:
DarkCat09 2024-12-21 11:30:36 +04:00
parent 33e135a13d
commit 667e6433a6
Signed by: DarkCat09
GPG key ID: BD3CE9B65916CD82

34
main.sh
View file

@ -57,43 +57,35 @@ echo
echo '==> Starting Unbound'
unbound -c ./unbound.conf -dp 2>unbound.log &
unbound_pid=$!
sleep 4
sleep 2
run_bench () {
hyperfine -N -w 30 \
"$exe_dig -p 2253 $1 $2 @127.0.0.1" \
"$exe_drill -p 2253 $1 $2 @127.0.0.1" \
"$exe_hr -n 127.0.0.1:2253 -t $1 $2"
}
echo
echo '==> Benchmarks for A domain.tld.'
hyperfine -N -w 30 \
"$exe_dig -p 2253 domain.tld @127.0.0.1" \
"$exe_drill -p 2253 domain.tld @127.0.0.1" \
"$exe_hr -n 127.0.0.1:2253 domain.tld"
run_bench A domain.tld
echo
echo '==> Benchmarks for AAAA domain.tld.'
hyperfine -N -w 30 \
"$exe_dig -p 2253 aaaa domain.tld @127.0.0.1" \
"$exe_drill -p 2253 aaaa domain.tld @127.0.0.1" \
"$exe_hr -n 127.0.0.1:2253 -t AAAA domain.tld"
run_bench AAAA domain.tld
echo
echo '==> Benchmarks for MX domain.tld.'
hyperfine -N -w 30 \
"$exe_dig -p 2253 mx domain.tld @127.0.0.1" \
"$exe_drill -p 2253 mx domain.tld @127.0.0.1" \
"$exe_hr -n 127.0.0.1:2253 -t MX domain.tld"
run_bench MX domain.tld
echo
echo '==> Benchmarks for CNAME mail.domain.tld.'
hyperfine -N -w 30 \
"$exe_dig -p 2253 mail.domain.tld @127.0.0.1" \
"$exe_drill -p 2253 mail.domain.tld @127.0.0.1" \
"$exe_hr -n 127.0.0.1:2253 mail.domain.tld"
run_bench A mail.domain.tld
echo
echo '==> Benchmarks for TXT txt.domain.tld.'
hyperfine -N -w 30 \
"$exe_dig -p 2253 txt txt.domain.tld @127.0.0.1" \
"$exe_drill -p 2253 txt txt.domain.tld @127.0.0.1" \
"$exe_hr -n 127.0.0.1:2253 -t TXT txt.domain.tld"
run_bench TXT txt.domain.tld
echo