Weights & Benchmarking
Last updated
Last updated
Weight: Unit of computation in Substrate
Bechmarking: Calculating the weights required for one pallet dispatchable function to be executed. Substrate benchmarking framework will re-run the logic calls to the dispatchable function defined in benchmarking.rs
multiple times.
Dispatchable function weights will be specified in pallet::weights
The Substrate runtime is composed of distinct pallets, each of which expose various dispatchable functions. The weight of each of these functions are completely independent of one another, and can vary based on the logical path executed based on the inputs and existing state.
To benchmark these runtime functions, we execute them within the actual Wasm runtime, in worst case scenarios. With runtime extrinsics where the input or existing state may effect the complexity of the execution, we test the extrinsic by varying those components and using regression analysis to extract results.
The runtime benchmarks are broken into two pieces:
Timing Dispatch Function Logic
Tallying Database Reads and Writes
Benchmarking your Substrate pallets:
How to retrieve the computational time for resources in Substrate: