Skip to content

Commit

Permalink
Interleaved comparing test
Browse files Browse the repository at this point in the history
  • Loading branch information
bazhenov committed Nov 30, 2023
1 parent 092f5f2 commit 2daaa68
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
34 changes: 34 additions & 0 deletions scripts/aws-bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

# This scripts is automating experiment on an AWS virtual machine
#
# The goal of an experiment is to measure performance variance reported by both harnesses (tango/criterion).
# UTF8 counting routine is used as a test function. The first one is counting up to 5000 characters in a string
# the second is up to 4950. We are expecting to see 1% difference in performance of those two functions

CRITERION=./target/criterion.txt
TANGO=./target/tango.txt
TANGO_FILTERED=./target/tango-filtered.txt

# Building and exporting all benchmarks. Align feature is used to disable inlining and to force 32-byte aligning
# of a tested functions. Without this trick the performance of the functions on Intel platform is heavily influenced
# by code aligning.
cargo +nightly export ./target/benchmarks -- bench --features=align --bench=criterion
cargo +nightly export target/benchmarks -- bench --features=align --bench='tango-*'

while :
do
date | tee -a "${CRITERION}" | tee -a "${TANGO}" | tee -a "${TANGO_FILTERED}"

# Running criterion benchmarks
./target/benchmarks/criterion --bench str_length_495 \
--warm-up-time 1 --measurement-time 1 | tee -a "${CRITERION}"
./target/benchmarks/criterion --bench str_length_500 \
--warm-up-time 1 --measurement-time 1 | tee -a "${CRITERION}"

# Running tango benchmarks
./target/benchmarks/tango_faster compare ./target/benchmarks/tango_slower \
-t 1000 -o -f 'str_length_limit' | tee -a "${TANGO}"
./target/benchmarks/tango_faster compare ./target/benchmarks/tango_slower \
-t 1000 -f 'str_length_limit' | tee -a "${TANGO_FILTERED}"
done
21 changes: 21 additions & 0 deletions scripts/aws-results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -eo pipefail

CRITERION=./target/criterion.txt
TANGO=./target/tango.txt
TANGO_FILTERED=./target/tango-filtered.txt

if [ "$1" == "tango" ]; then
cat "${TANGO}" | awk '{print $(NF)}' | egrep -o '(-|\+)[0-9]+\.[0-9]+'
fi

if [ "$1" == "tango-filtered" ]; then
cat "${TANGO_FILTERED}" | awk '{print $(NF)}' | egrep -o '(-|\+)[0-9]+\.[0-9]+'
fi

if [ "$1" == "criterion" ]; then
paste \
<(cat "${CRITERION}" | grep -A1 "str_length_5000" | grep 'time:' | awk '{print $5}') \
<(cat "${CRITERION}" | grep -A1 "str_length_4950" | grep 'time:' | awk '{print $5}') | \
awk '{print ($2 - $1) / $1 * 100}'
fi
2 changes: 1 addition & 1 deletion scripts/tango.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cargo export target/benchmarks -- bench --bench='tango-*'
time (
for i in {1..30}; do
./target/benchmarks/tango_faster compare ./target/benchmarks/tango_slower \
-t 1000 -f 'str_length_limit' >> "${FILE}"
-t 1000 -o -f 'str_length_limit' >> "${FILE}"
done
)

Expand Down

0 comments on commit 2daaa68

Please sign in to comment.