3

I watched polkadot seminar on benchmarking here:

https://www.youtube.com/watch?v=Qa6sTyUqgek&t=9177s

Can any one please guid how to benchmark a pallet public functions? more ever, it will be nice if there is some example with step wise explanation

1 Answer 1

0

Check this How-To-guide that explains how to write a simple benchmark for a pallet.

If you want to see an easy code example, you can check the Pallet template in the Substrate Node Template that is a simply pallet for example that has a function do_something and here you can see the code where is adding the benchmarking for that function.

If you want more complex examples, check the code of the FRAME pallets that are pallets provided by Substrate.

More information about Benchmarking: In the Substrate Docs and the Substrate Runtime Benchmarking Framework.

2
  • What is the difference between the macros in the how-to guide benchmarks! { .. } and the #[benchmark] in the pallet-template? Are they similar in functionality? Jul 29, 2023 at 14:29
  • The benchmarks! {} is the new benchmarking macro syntax. Check this PR: github.com/paritytech/substrate/pull/12924
    – Alex Bean
    Jul 31, 2023 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.