-
Notifications
You must be signed in to change notification settings - Fork 40
Logging to help debugging #107
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
Conversation
We should try to track down the perf, but the logging is important and it is worth the change. |
src/internal/partial_solution.rs
Outdated
.iter() | ||
.map(|(p, pa)| format!("{}: {}", p, pa)) | ||
.collect(); | ||
let assignments: Vec<_> = assignments.into_iter().collect(); |
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 think it would be clearer to collect into a vec and then call sort.
Cargo.toml
Outdated
@@ -23,12 +23,14 @@ include = ["Cargo.toml", "LICENSE", "README.md", "src/**", "tests/**", "examples | |||
thiserror = "1.0" | |||
rustc-hash = "1.1.0" | |||
serde = { version = "1.0", features = ["derive"], optional = true } | |||
log = { version = "0.4.14", default-features = false } # for debug logs in tests |
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.
No objection, just wondering:
What features are we trying to opted out of? Why default-features = false
?
I did not see any pref impact. So I addressed my nits, and made clippy happy. I will merge when CI is green. |
* feat: add logging to help debugging * debug: impl Display for partial solution * fix cherry picking * Fix display of assignments in partial_solution * debug: nits Co-authored-by: Jacob Finkelman <[email protected]>
* feat: add logging to help debugging * debug: impl Display for partial solution * fix cherry picking * Fix display of assignments in partial_solution * debug: nits Co-authored-by: Jacob Finkelman <[email protected]>
From my experiments with the interval design, I realized that being able to log the important steps of the solver was quite helpful to locate the origin of bugs. In this PR, I've introduced the
log
crate and added some calls tolog::info!()
in the solver. I've also addedenv_logger
to the dev dependencies to be able to display logs in failing tests.After running the benchmarks, I think this has an impact on the zuse bench where I saw roughly 10% slower performances. I did not notice performance changes on the other benchmarks. I wonder what it is though that could impact performances. I thought the
log
crate did not impact performances if it is not instantiated with a logger. Could this be because the fewDisplay
implementations that I added on some internal types?