-
Notifications
You must be signed in to change notification settings - Fork 167
perf: more assorted improvements #1986
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 pull request implements various performance optimizations across indexing and tuple flattening components, achieving incremental improvements without introducing regressions.
Key changes include:
- Refactored ComparisonIndexer to use a boolean flag instead of Comparator instances, reducing object allocations
- Optimized BiCompositeKey with custom equals/hashCode implementations to improve hash-based collection performance
- Converted FlattenItemBag from a record to a class with primitive int counter, eliminating MutableInt wrapper overhead
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ComparisonIndexer.java | Simplified comparison logic with boolean reverseOrder flag, refactored methods using switch expressions for cleaner code organization, and added specialized single/many indexer paths |
| BiCompositeKey.java | Added custom equals() and hashCode() implementations optimized for hash-based collection usage |
| AbstractFlattenLastNode.java | Eliminated MutableInt wrapper by converting FlattenItemBag to a class with primitive counter, refactored update/retract logic for better readability, and optimized removeExtras() with backward iteration |
💡 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/index/BiCompositeKey.java
Show resolved
Hide resolved
|


These changes focus largely (but not exclusively) on removing indirection.
Gets us a few percent here, few percent there, no regressions.