2

What does the #[extra] macro do in benchmarks?

I was looking at how benchmarks are being implemented on the Balances pallet. I notice the following benchmarks:

benchmarks_instance_pallet {
  transfer {}

  #[extra]
  transfer_best_case {}

 ...
}

When I searched the code for T::WeightInfo::transfer_best_case() I could not find where that was used in the balances code.

Can you please explain what the macro extra is doing?

Also, when looking at the benchmarks for transfer extrinsic I was expecting some seeded account data to calculate the worst-case scenario. Can you please explain the decision on not seeded accounts before hand?

1 Answer 1

3

That's an undocumented tag allowing to skip some benchmarks unless --extra flag is given. It was introduced in this PR. From the description:

  • A new #[extra] tag is introduced into the benchmarks! macro, allowing users to mark benchmarks as "extra" and have them excluded from the default running benchmarks.
  • Added --extra feature flag to benchmarking-cli to enable users to run the extra benchmarks
2
  • I see. I guess I do not understand why we would use this feature. Do you know?
    – Yatusabes
    Nov 16, 2022 at 17:25
  • 2
    As far as I understand, it is meant to write benchmarks that are just for the developer's information, but their results are not supposed to be included in the pallet's WeightInfo. Nov 16, 2022 at 21:33

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.