-
Notifications
You must be signed in to change notification settings - Fork 169
perf: further improve performance of precompute #1991
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
.../ai/timefold/solver/core/impl/domain/valuerange/buildin/bigdecimal/BigDecimalValueRange.java
Outdated
Show resolved
Hide resolved
...n/java/ai/timefold/solver/core/impl/domain/valuerange/buildin/collection/ListValueRange.java
Outdated
Show resolved
Hide resolved
...in/java/ai/timefold/solver/core/impl/domain/valuerange/buildin/collection/SetValueRange.java
Outdated
Show resolved
Hide resolved
...efold/solver/core/impl/domain/valuerange/buildin/composite/CompositeCountableValueRange.java
Outdated
Show resolved
Hide resolved
...java/ai/timefold/solver/core/impl/domain/valuerange/buildin/primdouble/DoubleValueRange.java
Outdated
Show resolved
Hide resolved
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 have a few minor suggestions for the hash logic to align it with Objects::hash.
|
I removed all unrelated hashing changes. |
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.
Pull request overview
This PR introduces a performance optimization for the precompute operation in the Bavet constraint solver by adding deduplication tracking to avoid redundantly iterating over tuple collections when the same object is updated multiple times within a single propagation cycle. Additionally, it includes minor code style improvements and an optimization to remove entries with empty tuple lists rather than storing them.
- Adds
alreadyUpdatingMapto track objects already processed in the current update cycle - Optimizes storage by removing empty mappings instead of storing empty lists
- Standardizes code formatting across method signatures
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
core/src/main/java/ai/timefold/solver/core/impl/bavet/common/RecordAndReplayPropagator.java
Outdated
Show resolved
Hide resolved
The update queue does deduplicate the updates. But we can skip iterating the entire collection, if we've already been over it once.
|
Okay, I'll skip the review then. |



The update queue does deduplicate the updates.
But we can skip iterating the entire collection, if we've already been over it once.
Another small bump in CS performance.
@Christopher-Chianelli Approach this with caution. I have seen this skip the collection more often than it iterates over it, but for that, the performance improvement is very small. There may be something I do not understand about this code.