I am trying to understand if quadratic complexity is bad (gives inaccurate results) when used for benchmarking:
I have a pallet whose weight would ideally depend on x * y
where x and y are lengths of two vectors. Just for context this is how the vector looks like Vec<_, Vec<_>>
. To replicate this, during benchmarking, the first thought that comes to mind is to make the benchmark a nested for loop :
fn benchmark(x: Linear<1, 5000> , y : Linear<1, 5000>) {
for i in 0 .. x {
for j in 0 .. y {
// setup input parameter
}
}
#[extrinsic_call]
}
Given that this input parameter is now depends on two variables that are kind of nested implying a complexity of O(i * j)
, is it okay for getting an accurate benchmark? Additional question: is this how you would set up a non-linear benchmark ?