Help with criterion

Hello everybody!

Let's say i want to compare the same function implemented in three different ways. This function accepts values in the range [0, M) and my goal is to bench the different implementations with every possible value within this range. Thus, I created a vector containing, in random order, each integer in that range (let's call every integer a slot).

Following the book, i came up with this idea:

let slots_to_probe = // vec with every possible slot in [0, M-1] in random order
let mut group = c.benchmark_group("probing");

for slot_to_probe in slots_to_probe.iter() {
        group.bench_with_input(... b.iter(|| first_struct[slot_to_probe]));

        group.bench_with_input(... b.iter(|| second_struct[slot_to_probe]));

        group.bench_with_input(... b.iter(|| third_struct[slot_to_probe]));

ps: the function is called by using the index trait on each struct (that has its own implementation).

The problem is the following: criterion creates, for each every slot, a directory in target/ plus another directory for every function where it stores another dir for every slot. This ends up consuming a lot of memory in no time. This is especially true when M is quite big, like 2^20.

The --no-plot option is available but i would like to get the final chart where the results are compared.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.