You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd love to separate out my project's benchmark definitions into multiple files, which divan seems to support via the [[bench]] cargo list method. However, I'd also like to set benchmark group options on each of these files, so that the #[bench] annotations don't have to repeat the same arguments over and over. Is there a good way to do that without introducing an "interim" module in each file?
I'd love to separate out my project's benchmark definitions into multiple files, which divan seems to support via the
[[bench]]
cargo list method. However, I'd also like to set benchmark group options on each of these files, so that the#[bench]
annotations don't have to repeat the same arguments over and over. Is there a good way to do that without introducing an "interim" module in each file?I've tried:
Having a "main" file that uses submodules:
That fails because procmacro annotations on external files are not stable.
Using a module-global
bench_group
annotationSame as above, one
main.rs
file that usesmod multi_threaded;
but inside the multi_threaded.rs file,#![bench_group(threads=THREADS)
This fails because module-wide procmacro annotations aren't stable.
Using an interim module in each benchmark file
Here, put the
main
function into multi_threaded.rs, then pull in a submodule inside the file as a layer to set those benchmark options on:This works, but results in a tree like:
...and I'd love to get rid of that interstitial module layer.
Possible solutions
main
function that accepts benchmark group options?The text was updated successfully, but these errors were encountered: