0

What if we don't provide range inside benchmark and provide 10 in steps while running benchmark? Is there any default range provided by framework or is there anything else will happen in this case?

1 Answer 1

2

You can take a look at the implementation here:

https://github.com/paritytech/substrate/blob/master/utils/frame/benchmarking-cli/src/pallet/command.rs

let mut all_components = Vec::new();
for (idx, (name, low, high)) in components.iter().enumerate() {
    let lowest = self.lowest_range_values.get(idx).cloned().unwrap_or(*low);
    let highest = self.highest_range_values.get(idx).cloned().unwrap_or(*high);

    let diff = highest - lowest;

    // Create up to `STEPS` steps for that component between high and low.
    let step_size = (diff / self.steps).max(1);
    let num_of_steps = diff / step_size + 1;
    for s in 0..num_of_steps {
        // This is the value we will be testing for component `name`
        let component_value = lowest + step_size * s;

        // Select the max value for all the other components.
        let c: Vec<(BenchmarkParameter, u32)> = components
            .iter()
            .enumerate()
            .map(|(idx, (n, _, h))| {
                if n == name {
                    (*n, component_value)
                } else {
                    (*n, *self.highest_range_values.get(idx).unwrap_or(h))
                }
            })
            .collect();
        all_components.push(c);
    }
}
all_components

So in the case you don't have a range, we only have 1 step for "steps", and will use all the repeats.

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.