Skip to content

Conversation

mpizenberg
Copy link
Member

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 to log::info!() in the solver. I've also added env_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 few Display implementations that I added on some internal types?

@Eh2406
Copy link
Member

Eh2406 commented Aug 8, 2021

We should try to track down the perf, but the logging is important and it is worth the change.

.iter()
.map(|(p, pa)| format!("{}: {}", p, pa))
.collect();
let assignments: Vec<_> = assignments.into_iter().collect();
Copy link
Member

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
Copy link
Member

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?

@Eh2406
Copy link
Member

Eh2406 commented Aug 21, 2021

I did not see any pref impact. So I addressed my nits, and made clippy happy. I will merge when CI is green.

@Eh2406 Eh2406 merged commit 0cb82a4 into dev Aug 21, 2021
@Eh2406 Eh2406 deleted the log branch August 21, 2021 21:10
Eh2406 added a commit that referenced this pull request Aug 21, 2021
* 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]>
zanieb pushed a commit to astral-sh/pubgrub that referenced this pull request Nov 8, 2023
* 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]>
This was referenced Nov 15, 2023
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

Successfully merging this pull request may close these issues.

2 participants