-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Create Script to Run All Benchmarks #11493
Changes from 3 commits
024a98b
c73fa78
a6063e9
4c727d6
8a13718
3188b3c
a8f16de
a5964ee
fa4e644
654538c
7e17334
23690da
a440440
bb8b62b
fb03b54
3c2ce54
22c54df
0cfad7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| # Runs all benchmarks for all pallets, for the Substrate node. | ||
| # Should be run on a reference machine to gain accurate benchmarks | ||
| # current reference machine: https://github.com/paritytech/substrate/pull/5848 | ||
|
|
||
| echo "[+] Running all benchmarks for Substrate" | ||
|
|
||
| if [ $1 != "skip-build" ] | ||
| then | ||
| cargo +nightly build --profile production --locked --features=runtime-benchmarks | ||
ggwpez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| fi | ||
|
|
||
| ./target/production/substrate benchmark pallet \ | ||
| --chain=dev \ | ||
| --list |\ | ||
| tail -n+2 |\ | ||
| cut -d',' -f1 |\ | ||
| uniq > "substrate_pallets" | ||
ggwpez marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # For each pallet found in the previous command, run benches on each function | ||
| while read -r line; do | ||
| pallet="$(echo "$line" | cut -d' ' -f1)"; | ||
| folder_name="$(echo "${pallet#*_}" | tr '_' '-')"; | ||
| echo "Pallet: $pallet, Folder Name: $folder_name"; | ||
| # '!' has the side effect of bypassing errexit / set -e | ||
| ! ./target/production/substrate benchmark pallet \ | ||
| --chain=dev \ | ||
| --steps=50 \ | ||
| --repeat=20 \ | ||
| --pallet="$pallet" \ | ||
| --extrinsic="*" \ | ||
| --execution=wasm \ | ||
| --wasm-execution=compiled \ | ||
| --template=./.maintain/frame-weight-template.hbs \ | ||
| --output="./frame/${folder_name}/src/weights.rs" | ||
| done < "substrate_pallets" | ||
| rm "substrate_pallets" | ||
|
|
||
| # Benchmark base weights | ||
| ! ./target/production/substrate benchmark overhead \ | ||
| --chain=dev \ | ||
| --execution=wasm \ | ||
| --wasm-execution=compiled \ | ||
| --weight-path="./frame/support/src/weights/" \ | ||
| --warmup=10 \ | ||
| --repeat=100 | ||
|
|
||
|
|
||
| # This true makes sure that $? is 0 instead of | ||
|
||
| # carrying over a failure which would otherwise cause | ||
| # the whole CI job to abort. | ||
| true | ||
Uh oh!
There was an error while loading. Please reload this page.