Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bench with huge input #740

Open
ciminilorenzo opened this issue Nov 8, 2023 · 0 comments
Open

Bench with huge input #740

ciminilorenzo opened this issue Nov 8, 2023 · 0 comments

Comments

@ciminilorenzo
Copy link

ciminilorenzo commented Nov 8, 2023

Let's say i want to compare three data structures that, in their way, probe a vector of size M (as you can see the probing logic is performed by using the index trait) by accepting a parameter that goes from 0 up to M-1. I would like to test my structures' behavior with every possibile input (let's call it 'slot') i.e. every possibile value from 0 up to M-1. Thus, i have something like that:

let slots_to_probe = VEC_WITH_EVERY_POSSIBILE_SLOT
let mut group = c.benchmark_group("probing");

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

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

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

My goal is to get the report/lines.svg chart showing the comparison. The problem arises when the vector is quite big (like 2^20 elements) since criterion creates a directory in target/ for each slot plus another directory for every function where it stores another dir for every slot. This implies consuming a lot of memory very soon.

I tried to use --noplot when running the bench but it avoids creating even the chart that i need. Even looking into the criterion's documentation, i have not been able to find a suitable solution for my case.

Ps: when trying to reduce the number of slots to bench with, i've been able to get correctly the chart only when going down up to something like 1000 slots since, with bigger sets of values, i was getting called Result::unwrap() on an Err value: Os { code: 35, kind: WouldBlock, message: "Resource temporarily unavailable" }.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant