2

When running benchmarks do the result consider that multiple reads to the same value per block are cached as mentioned in the documentation referenced below?

If caching is not considered in the benchmarks:

  • Is it possible to run benchmarks with cache and how?
  • Is it recommended to run benchmarks with cache?

Runtime storage allows you to store data in your blockchain that is persisted between blocks and can be accessed from within your runtime logic

https://docs.substrate.io/v3/runtime/storage/

Multiple reads of the same value count as one read.

https://docs.substrate.io/v3/runtime/weights-and-fees/#parameterizing-over-database-accesses

1 Answer 1

2

Benchmarking does always take caching into account.
The BenchmarkingState which is used by the Pallet benchmarking counts storage Reads/Writes per key.
It then only takes at most one of each, therefore assuming that a key cannot be Read/Written more than once per block here.
This works since all storage modifications are cached until the whole block gets written back to storage.

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.