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

Replace mutex-guarded map with sync.Map #63

Merged
merged 5 commits into from
Nov 26, 2023
Merged

Conversation

perbu
Copy link
Collaborator

@perbu perbu commented Nov 26, 2023

sync.Map is quite fast, in particular for reads (5-10x). It's a bit slower for writes, but not much. On a Mac, a combination of 2 Gets and a Set will get a speedup of 2.5x with this PR.

I was planning to remove the whole package but as sync.Map isn't really type safe, I think we should keep it around so we have a type-safe map. The wrapper shouldn't impact performance, I think.

This PR should be ready to merge if you want it.

@perbu
Copy link
Collaborator Author

perbu commented Nov 26, 2023

closes #61

@anthdm anthdm merged commit c7be50d into anthdm:master Nov 26, 2023
1 check passed
@perbu perbu deleted the nosafemapo branch November 26, 2023 08:56
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