-
Notifications
You must be signed in to change notification settings - Fork 169
perf: improve precompute performance by optimizing updates #1977
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
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 optimizes the performance of precompute operations by eliminating intermediate data structures in the update path. The optimization removes the updateQueue from RecordAndReplayPropagator and delegates deduplication directly to StaticPropagationQueue, which already handles duplicate updates efficiently via tuple state checking.
Key Changes
- Removed the intermediate
updateQueuefield and its associated processing overhead - Modified
update()method to directly propagate updates to the tuple-level queue instead of collecting them at the object level - Simplified
propagateUpdates()to directly delegate to the propagation queue
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
RecordAndReplayPropagator.java |
Removed updateQueue field and refactored update handling to bypass object-level queuing and deduplication, directly calling propagationQueue.update() for each tuple |
PropagationQueue.java |
Added Javadoc clarifying that duplicate updates of the same item are deduplicated |
💡 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/PropagationQueue.java
Outdated
Show resolved
Hide resolved
…ropagationQueue.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|



In my benchmarks, I see speedups of 20-25 %.
This should significantly improve the viability of
precompute.Looking at the insert/retract logic, we probably over-designed this. The de-duplication is very heavy, for something that barely ever happens. But retracts and inserts also barely ever happen themselves, so this code doesn't show up in profiling at all and therefore I'm not touching it.