Use this documentation on benchmarking. It is very good and will give all info you need.
To start existing benchmark tests I propose following steps:
- rename
pallets/rmrk-core/src/weights.rs
toold_weights.rs
. Just to keep it for referrence - examine the tests in
benchmarks.rs
files. They will produce measurements for the newweights.rs
file - compile node with --features runtime-benchmarks
- since rmrk node is missing production profile, use
--profile=release
in cargo build. Therefore instead of:
cd bin/node/cli
cargo build --profile=production --features runtime-benchmarks
use this:
cd bin/node/cli
cargo build --profile=release --features runtime-benchmarks
- after building, run the node with:
./target/release/rmrk-substrate benchmark pallet \
--chain dev \
--execution=wasm \
--wasm-execution=compiled \
--pallet pallet_rmrk_core \
--extrinsic "*" \
--steps 50 \
--repeat 20 \
--output pallets/rmrk-core/src/weight.rs
- this will generate new
pallets/rmrk-core/src/weight.rs
- compare
old_weights.rs
and newly genetatedweights.rs
. You will see missing trait and some renaming. This could be fixed with template file like this- I never found time to explore that and I mannualy changed that trait
- check also
runtime/src/lib
file. in the pallet_rmrk_core there is nowWeightInfo
which points to this newly generatedweights.rs
file
type WeightInfo = pallet_rmrk_core::weights::SubstrateWeight<Runtime>;
- you can also run all benchmark tests before building node:
cargo test --package pallet-rmrk-core --features runtime-benchmarks