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
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.
-
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 Apr 26 at 12:21
FRAME benchmarking is only for pallet calls. Everything else can use Criterion et. al.