Benchmarking
Last updated
Was this helpful?
Last updated
Was this helpful?
measures execution time and resource usage for pallets and extrinsics, ensuring accurate weight calculations and optimal performance.
With Pop CLI, you can benchmark pallets and extrinsics interactively by managing parameters efficiently. Run the following command to start benchmarking:
Note that the command requires the frame-omni-bencher
binary to be installed on your local machine.
Pop CLI will automatically source the
frame-omni-bencher
binary if not found on your local machine.
Provide a runtime to benchmark
The command requires a runtime built with the runtime-benchmarks
feature. Pop CLI detects available runtimes in your project, allowing you to choose one if multiple exist.
If the binary is missing, Pop CLI builds it with the appropriate build profile
and features. You can manually specify the runtime binary path using:
By default, whenever benchmarking starts, the runtime binary will be automatically built to ensure that it is current. You can provide a flag --no-build
or -n
manually to skip the build process if there is an existing runtime binary.
Configure the genesis builder policy and preset
There are two options for the genesis builder policy:
none
: Do not provide any genesis state.
runtime
: Use the runtime's genesis preset.
To configure the genesis builder manually, you can use the --genesis-builder
flag. For example:
To configure the genesis builder preset manually, you can use the --genesis-builder-preset
flag:
Select pallets and extrinsics
You'll be prompted to benchmark all pallets or select a specific one. Pop CLI lists all available pallets within the runtime, allowing you to search by name and choose from the list.
You can simply search for pallets by typing their name and selecting them from the list.
If a pallet is specified, the CLI will prompt you to select the extrinsics you want to benchmark within that pallet. You can select multiple extrinsics by pressing the spacebar. Same as searching for pallets, you can search for extrinsics by typing their name as well.
If --extrinsic=
and --pallet=
are provided, the CLI will skip the search and directly benchmark with the specified arguments.
Manage parameters
Pop CLI displays all editable parameters, allowing you to preview and modify them as needed. Simply select a parameter to provide a new value.
To skip parameter configuration, you can use the
--skip-parameters
flag.
For example, to update the High
parameter:
And you will see the value is updated:
Save weight output and parameter values to file
After the providing parameter values, you will be prompted to save the weight output and provided parameter values to a file. If not provided, no weight output will be saved.
To save parameter values, the file path is default to pop-bench.toml
.
Below is the example of the parameter file:
With the saved parameter file, you can load parameter values from the file by using the -f
or --bench-file
flag.
For more advanced parameter configuration, you can run the following command to learn more:
Technical Support
Genesis builder policy defines the way to construct the .
The genesis preset is configured on the runtime via crates which contains a runtime-api to be implemented by runtimes, in order to express their genesis state.
🧑🏫 To learn about Polkadot in general, website is a good starting point.
🧑🔧 For technical introduction, are the Polkadot SDK documentation resources.
To learn about benchmarking, provides all the fundamentals.
More advanced breakdown of benchmarking is covered in .
Create a question and tag it with ""
Share the StackExchange question in our