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

"cargo bench -- <filter>" does not actually filter the benchmarks #763

Open
micheleAndreata opened this issue Mar 6, 2024 · 0 comments
Open

Comments

@micheleAndreata
Copy link

Lets suppose I have a function that performs benchmarks on a grid of parameters, hence it requires a lot of time to complete. I also have a function that performs a very simple benchmark. The two functions have ID "slow" and "fast" respectively and the code in my_benchmark.rs is the following:

criterion_group!(benches, bench_slow, bench_fast);
criterion_main!(benches);

Now, if i run the benchmarks with a filter, like cargo bench -- fast, it gets stuck for a while at the beginning and eventually performs the fast benchmark. This is even more evident when i try to revert the order of the bench functions, writing criterion_group!(benches, bench_fast, bench_slow); instead, which executes the fast benchmark immediately and then gets stuck. It seems that it doesn't actually filter the benchmarks but it silently executes them.

Am I doing this wrong? Is this the intended behaviour? Thanks in advance for the help.

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