-
Notifications
You must be signed in to change notification settings - Fork 2
optimize entry cleanup #25
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
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 871 901 +30
=========================================
+ Hits 871 901 +30 ☔ View full report in Codecov by Sentry. |
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 entry cleanup mechanism in LockMap by introducing a StateFlags struct that packs both the reference count and a "has value" flag into a single AtomicU32. This allows the cleanup logic to check both conditions atomically without needing to inspect the actual value under lock.
Key changes:
- Introduced
StateFlagsstruct with bit-packed reference count (31 bits) and has-value flag (1 bit) - Replaced
State<V>.refcntwithState<V>.flagsthroughout the codebase - Updated entry drop implementations to set the value flag before attempting cleanup
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR optimizes the entry cleanup mechanism in
LockMapby introducing aStateFlagsstruct that packs both the reference count and a "has value" flag into a singleAtomicU32. This allows the cleanup logic to check both conditions atomically without needing to inspect the actual value under lock.