Skip to content

Conversation

@SF-Zhou
Copy link
Owner

@SF-Zhou SF-Zhou commented Dec 29, 2025

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.

Copilot AI review requested due to automatic review settings December 29, 2025 14:26
@codecov
Copy link

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b018dc3) to head (c05ac23).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

Copilot AI left a 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 StateFlags struct with bit-packed reference count (31 bits) and has-value flag (1 bit)
  • Replaced State<V>.refcnt with State<V>.flags throughout 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.

Copy link
Contributor

Copilot AI left a 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.

@SF-Zhou SF-Zhou merged commit 67bf8db into main Dec 30, 2025
7 checks passed
@SF-Zhou SF-Zhou deleted the dev branch December 30, 2025 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants