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

proposal: sync: On changing the sync.Map implementation to a Ctrie Map (HashTrieMap) #67009

Closed
aimuz opened this issue Apr 24, 2024 · 1 comment
Labels
Milestone

Comments

@aimuz
Copy link
Contributor

aimuz commented Apr 24, 2024

Proposal Details

It's not a proposal, it's more of a discussion. I found some interesting changes in the recent commit, I observed the addition of a concurrent/HashTrieMap implementation which is internal.

I think sync.Map should have better performance by way of a HashTrieMap implementation? I didn't do a full test. I just think it has a smaller lock range and doesn't look like the existing sync.Map implementation. Map, which locks the entire map during writes.

The main use case for sync.Map is to solve the problem of concurrent reads and writes. HashTrieMap is designed to be thread-safe and lock-free. So I think using HashTrieMap to implement sync.

As far as I know, there is already a community implementation of sync.Map based on the HashTrieMap implementation

https://github.com/puzpuzpuz/xsync

(Please feel free to correct me if there are any questions, my understanding is not complete)

@aimuz aimuz added the Proposal label Apr 24, 2024
@gopherbot gopherbot added this to the Proposal milestone Apr 24, 2024
@seankhliao
Copy link
Member

closing since we don't use the issue tracker for general discussions.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants