-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a37ff13
commit 1f5bcb4
Showing
1 changed file
with
35 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
START=874000 | ||
END=874009 | ||
NET=mainnet | ||
LAPS=100 | ||
usage() { | ||
cat <<EOF | ||
Usage: $0 <start> <end> <net> <laps> | ||
Benches a block range | ||
- Saves output to native-<start>-<end>-<net> and vm-<start>-<end>-<net> | ||
- Prints speedup | ||
EOF | ||
} | ||
|
||
if ! [ "$#" -ge "4" ]; then | ||
usage | ||
exit 1 | ||
fi | ||
|
||
|
||
START=$1 | ||
END=$2 | ||
NET=$3 | ||
LAPS=$4 | ||
|
||
output="block-$START-$END-$NET.jsonl" | ||
native_output="native-$output" | ||
vm_output="vm-$output" | ||
|
||
echo "Executing with Native" | ||
cargo run --release --features benchmark,structured_logging bench-block-range "$START" "$END" "$NET" "$LAPS" > "$native_output" | ||
|
||
native_time=$(tail -n1 "$native_output" | jq .fields.average_run_time) | ||
echo "Average Native time: $native_time" | ||
|
||
echo "Executing with VM" | ||
cargo run --release --features benchmark,structured_logging,only_cairo_vm bench-block-range "$START" "$END" "$NET" "$LAPS" > "$vm_output" | ||
|
||
cargo run --release --features benchmark,structured_logging bench-block-range $START $END $NET $LAPS | tee "native-$output" | ||
vm_time=$(tail -n1 "$vm_output" | jq .fields.average_run_time) | ||
echo "Average VM time: $vm_time" | ||
|
||
cargo run --release --features benchmark,structured_logging,only_cairo_vm bench-block-range $START $END $NET $LAPS | tee "vm-$output" | ||
speedup=$(bc -l <<< "$vm_time/$native_time") | ||
echo "Native Speedup: $speedup" |