-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Improve hash implementations for paths in Matter.framework. #41368
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
This gives better set-insertion behavior.
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 improves hash function implementations for various path objects in the Matter framework to provide better set-insertion behavior. The changes replace simple bit-shifting hash calculations with a centralized, more sophisticated hash function.
- Introduces a new
HashPathutility function that provides optimized hash calculations for different NSUInteger sizes - Replaces existing hash implementations across multiple path classes to use the centralized function
- Updates bit allocation strategy to reduce hash collisions
|
PR #41368: Size comparison from a6bb081 to 0a2c56c Full report (37 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
|
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.
Code Review
This pull request improves the hash implementations for various path objects, which should lead to better performance in hash-based collections. The introduction of a centralized HashPath function is a good approach. I've found a couple of issues: one is a bug in the new HashPath function that could lead to hash collisions, and the other is an inconsistency in -[MTRClusterPath hash] which doesn't use the new helper function. My review includes suggestions to fix these issues to make the hashing more robust and consistent.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41368 +/- ##
==========================================
- Coverage 50.95% 50.95% -0.01%
==========================================
Files 1378 1378
Lines 100614 100643 +29
Branches 13025 13028 +3
==========================================
+ Hits 51272 51283 +11
- Misses 49342 49360 +18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
PR #41368: Size comparison from a6bb081 to aa6356d Full report (37 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
|
This gives better set-insertion behavior.
Testing
Manual measurements of the number of isEqual calls that happen during set operations.