-
Notifications
You must be signed in to change notification settings - Fork 2
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
Benchmarking with Criterion.rs #156
base: main
Are you sure you want to change the base?
Conversation
Could someone verify whether the pre-commit failure to compile issue is spurious? It works on my machine, so I wonder if it just doesn't know what to do with the Criterion benchmark code. |
@RobertJacobsonCDC I can reproduce locally running clippy with |
b6a865b
to
fc85f08
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm kind of suspicious of this overall structure where we have to incorporate all the files from the programs we're benchmarking. Is there instead some way to make them a library and then pull in the library separately from the criterion driver and the example main? Open to other alternatives, but I don't think linking to all the individual files is good practice.
fc85f08
to
6f86acc
Compare
.vscode | ||
.idea | ||
|
||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
target/ | ||
**/target/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The libraries for the examples can now have their own target
directory.
The examples are largely unchanged. The paths to input and output files were adjusted for them. Running benchmarks:
Running examples:
|
f761f60
to
32c3e4f
Compare
…enches` directory, `example_births_deaths`, `example_basic_infection` benchmarks, README.md explaining how to run benchmarks and profile with samply.
…hare code with the benchmarks.
32c3e4f
to
d726163
Compare
…hare code with the benchmarks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This structure still doesn't feel right. Added a comment inline, but happy to discuss live.
static SEED: u64 = 123; | ||
static MAX_TIME: f64 = 303.0; | ||
|
||
fn basic_infection() -> Context { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code appears to largely duplicate basic-infection/lib.rs, which isn't great.
The way I expected this to work is that each example lib exposes a single function that encapsulates the entire simulation and is called something like main_inner()
and is effectively main. And then you would call main_inner()
from either the true main or from the benchmarking framework.
Is there a reason that can't work?
benches
directory,example_births_deaths
,example_basic_infection
benchmarks.