Skip to content
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

perf: improve locking code #637

Merged
merged 11 commits into from
Dec 7, 2024
Merged

Conversation

mattjohnsonpint
Copy link
Member

Description

There are a few places where we can improve locking code. Specifically:

  • Replace double-checked locking on singleton object instantiation with sync.Once
  • Replace double-checked locking on maps with a concurrent map
  • Ensure defer is used correctly to release mutex locks where still used

For the concurrent map, I evaluated both sync.Map and xsync.MapOf, and decided on the latter.

Checklist

  • Code compiles correctly and linting passes locally
  • For all code changes, an entry added to the CHANGELOG.md file describing and linking to this PR

@mattjohnsonpint mattjohnsonpint requested a review from a team as a code owner December 6, 2024 21:41
@mattjohnsonpint mattjohnsonpint marked this pull request as draft December 6, 2024 21:45
@mattjohnsonpint mattjohnsonpint marked this pull request as ready for review December 6, 2024 22:05
@mattjohnsonpint mattjohnsonpint marked this pull request as draft December 6, 2024 22:08
@mattjohnsonpint mattjohnsonpint force-pushed the mjp/hyp-2738-improve-locking-code branch from b76c8bb to 3931766 Compare December 7, 2024 01:20
@mattjohnsonpint mattjohnsonpint marked this pull request as ready for review December 7, 2024 01:30
@mattjohnsonpint mattjohnsonpint enabled auto-merge (squash) December 7, 2024 01:33
@mattjohnsonpint mattjohnsonpint merged commit 4a32e44 into main Dec 7, 2024
90 checks passed
@mattjohnsonpint mattjohnsonpint deleted the mjp/hyp-2738-improve-locking-code branch December 7, 2024 01:34
@mattjohnsonpint mattjohnsonpint restored the mjp/hyp-2738-improve-locking-code branch December 7, 2024 01:35
@mattjohnsonpint mattjohnsonpint deleted the mjp/hyp-2738-improve-locking-code branch December 7, 2024 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants