perf: improve performance of ConnectedRange collector#2473
Merged
Conversation
Collaborator
Author
|
Adding @Christopher-Chianelli to review the range work. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR targets solver runtime improvements by optimizing the connected-ranges collector (reducing hash/alloc overhead) and fixing an iterator staleness bug that can impact overall solving performance.
Changes:
- Optimized connected-range hashing and reduced allocation overhead in connected-ranges internals.
- Reworked join-node filtered update handling to avoid expensive scans by introducing versioned “mark” support in
TupleList. - Added/updated tests to cover incremental join updates and connected-range hash-code behavior; added a focused test for
UnindexedJoinBiNodeupdate semantics.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| core/src/test/java/ai/timefold/solver/core/impl/score/stream/common/bi/AbstractBiConstraintStreamTest.java | Adds incremental-update regression tests for joins with filtering and unchanged keys. |
| core/src/test/java/ai/timefold/solver/core/impl/score/stream/collector/connected_ranges/ConnectedRangeTrackerTest.java | Refactors test code and adds hashCode/equals consistency and mutation coverage. |
| core/src/test/java/ai/timefold/solver/core/impl/bavet/bi/UnindexedJoinBiNodeTest.java | New unit tests asserting left/right update refresh behavior in unindexed joins. |
| core/src/main/java/ai/timefold/solver/core/impl/score/stream/collector/connected_ranges/RangeSplitPoint.java | Tweaks split-point internal data structures and iterator to improve performance. |
| core/src/main/java/ai/timefold/solver/core/impl/score/stream/collector/connected_ranges/ConnectedRangeImpl.java | Introduces cached hashCode and reorders equality checks for performance. |
| core/src/main/java/ai/timefold/solver/core/impl/score/stream/collector/connected_ranges/ConnectedRangeChainImpl.java | Excludes splitPointSet from hashCode to avoid expensive hashing. |
| core/src/main/java/ai/timefold/solver/core/impl/heuristic/selector/move/composite/BiasedRandomUnionMoveIterator.java | Fixes stale-refresh behavior to avoid unnecessary rebuilds and ensure correctness. |
| core/src/main/java/ai/timefold/solver/core/impl/bavet/common/tuple/TupleList.java | Adds versioned mark/getMark to support faster join-node updates. |
| core/src/main/java/ai/timefold/solver/core/impl/bavet/common/AbstractJoinNode.java | Uses versioned marks to avoid scanning partner lists during filtered updates; refactors retract/update helpers. |
Christopher-Chianelli
approved these changes
Jul 7, 2026
Christopher-Chianelli
left a comment
Contributor
There was a problem hiding this comment.
LGTM; can probably simplify the hashCode/equals even more.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This contains two separate commits: