2

I am trying to understand why there is no complexity parameter on transfer benchmarks.

The substrate benchmarks documentation states:

For benchmarks, you want to execute the most computationally intensive path.

I noticed benchmarks for balances transfer not have a complexity parameter.

In the benchmarks, I expected to see some seeding of accounts to get the most computationally intensive. I was surprised when I saw no account seeding or complexity parameters being used.

Can you explain why a complexity parameter or accounts seeding is unnecessary for benchmarking transfers?

I have a similar extrinsic that is associated with a storage map that is unbounded. I am trying to understand how to properly benchmark something like this.

1 Answer 1

2

The logic associated with a balance transfer is constant complexity.

As the number of users in your system grows, there will be an increase in complexity due to the size of the merkle trie, but this is accounted for with database benchmarking, which is explicitly separate from the extrinsic benchmarking.

You can learn more about storage benchmarks here: https://github.com/paritytech/substrate/blob/master/utils/frame/benchmarking-cli/src/storage/README.md

I have a similar extrinsic that is associated with a storage map that is unbounded. I am trying to understand how to properly benchmark something like this.

You should make sure your database benchmarking uses the storage map with the largest expected size.

3
  • I understand what you're saying, but I need a little clarity. The document states that I should update the database weights periodically. > "regularly update these weights as the chain grows. However, you're saying I should use the storage map with the largest expected size. Can you clarify how I should do this? What does this mean when your state is empty because you're a new chain? Should I still use a snapshot?
    – Yatusabes
    Commented Nov 22, 2022 at 2:44
  • 2
    There isn't a perfect answer here. Fortunately merkle tries scale exponentially. That is, from 16^5 to 16^6, you go from 1 million items to 16 million items. if you expect to have 1 million users, you should set your storage benchmarks to 16^6, and know that your chain will be safe up to 16 million users, which then you should go to 16^7, and know you will be good for nearly 300 million users.
    – Shawn Tabrizi
    Commented Nov 22, 2022 at 6:34
  • how do I do this? Is this a configuration? "You should ensure your make sure benchmarking uses the storage map with the largest expected size." Are you saying to do this: cargo run --release -p node-bench -- ::trie::read::large - shawntabrizi.com/substrate-graph-benchmarks/docs/#/database
    – Yatusabes
    Commented Nov 23, 2022 at 0:09

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.