Implement average of multiple trials.
This commit is contained in:
13
benchmark.sh
13
benchmark.sh
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
BIN="./target/release/indivisible"
|
||||
TRIALS=20
|
||||
|
||||
if ! [ -f "$BIN" ]
|
||||
then
|
||||
@@ -8,4 +9,14 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
time "$BIN" 100000000
|
||||
echo "Calculating primes up to 100,000,000"
|
||||
TOTAL="0"
|
||||
for _ in $(seq "$TRIALS")
|
||||
do
|
||||
TIME=$(command time -f "%e" "$BIN" 100000000 2>&1 >/dev/null)
|
||||
TOTAL=$(calc "$TOTAL + $TIME")
|
||||
done
|
||||
|
||||
AVG=$(calc "$TOTAL / $TRIALS")
|
||||
|
||||
echo "Average time: ${AVG}s"
|
||||
|
||||
Reference in New Issue
Block a user