diff --git a/main.sh b/main.sh index ff0aaba..8e50662 100755 --- a/main.sh +++ b/main.sh @@ -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