-
Notifications
You must be signed in to change notification settings - Fork 538
Benchmarks
You can run any benchmark and generate the proper weight.rs
file. In the following command, we are
running the benchmarks from da-control
pallet, and the generated file is
$> cargo run --release -p avail-node --features runtime-benchmarks -- \
benchmark \
pallet \
--chain=dev \
--steps=30 \
--repeat=20 \
--log=warn \
--template=./.maintain/frame-weight-template.hbs \
--header=./HEADER-APACHE2 \
--pallet=da-control \
--extrinsic=* \
--output=./output/weights.rs
To benchmark all extrinsics for all pallets:
$> cargo run --release -p avail-node --features runtime-benchmarks --
benchmark
pallet
--chain=dev
--steps=30
--repeat=20
--log=warn
--template=./.maintain/frame-weight-template.hbs
--header=./HEADER-APACHE2
--pallet=*
--extrinsic=*
--output=./output/weights.rs
To benchmark long running features like the kate commitment generation
, you can specify --extra
as additional flag.
To run all benchmarks from all pallets:
./run_benchmarks.sh
You can customize the number of steps and repeats for the benchmarks using environment variables. For example, to set the number of steps to 4 and the number of repeats to 20, use the following command:
STEPS=4 REPEAT=20 ./run_benchmarks.sh
If you only want to run benchmarks just for our own custom pallets, you can set the OUR_PALLETS environment variable:
OUR_PALLETS=1 ./run_benchmarks.sh
To run benchmarks for specific pallets, you need to set the PALLETS environment variable and provide a space-separated list of pallet names. For example, to run benchmarks for the frame_system and mocked_runtime pallets, use the following command:
PALLETS="frame_system mocked_runtime" ./run_benchmarks.sh
To benchmark long running features like the kate commitment generation
,
you can specify EXTRA=1
as additional environment variable.
EXTRA=1 ./run_benchmarks.sh
When computing benchmarks, additionally to weights
, PoV
proof of validity (proof size) will be computed based on storage usage.
If no storage is used, PoV
will be 0.
By default the benchmark PoV is #[pov_mode = MaxEncodedLen]
this should always be the case.
For rare cases, MaxEncodedLen
won't be specified for a storage then for benchmarks that use this storage, #[pov_mode = Measured]
should explicitely be specified.