3

I have some heavy computation done off-chain (in outer node) and i want to benchmark those functions, does substrate offer tools for doing it or should i rely on a third party library to do that?

2 Answers 2

1

The purpose of benchmarking in Substrate is to measure the resources and time it takes to execute different functions in the runtime and accurately assign weights to extrinsics, which determine their priority in the transaction queue

If the computation is done outside the runtime there is no real purpose for assigning weights to those functions.

But in the end benchmarks are just tests under the hood, so the traditional testing framework built in Rust should allow you to get any of the values you need to estimate the resources that your functions are using.

1
  • in my case the computation offchain affects the other 4 seconds because its done during block import so it should affect the weight, but i think you are right, i remember tests showing an estimate of how many seconds it take
    – dadzerlaze
    Commented Apr 26, 2023 at 12:21
0

FRAME benchmarking is only for pallet calls. Everything else can use Criterion et. al.

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.