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

Does btree.Map use concurrency locks? #22

Closed
benduckwdesign opened this issue Nov 11, 2022 · 2 comments
Closed

Does btree.Map use concurrency locks? #22

benduckwdesign opened this issue Nov 11, 2022 · 2 comments

Comments

@benduckwdesign
Copy link

Just a general question, noticed NewMap does not have the option to turn locks on or off like btree.New does.

@tidwall
Copy link
Owner

tidwall commented Nov 14, 2022

That’s correct. Map does not have built in locks.

@benduckwdesign
Copy link
Author

I had a database lock wrapper implementation for standard Go maps which was about 600ns/op for random in-memory reads, but using btree.Map seemed to have worse performance over the standard implementation in my test scenario which is why I thought maybe I was putting locks over locks.

Since then I have moved over to using a custom implementation of sync.Map (thus removing my lock wrapper, down to 400ns/op random in-memory reads,) but I'm not sure if the techniques used (one dirty store, one read-only store) would be efficient or applicable for btree structure in order to create a potentially faster "btree.SyncMap". Not asking for an implementation, nor am I committing to contributing one, but it's a curious idea.

In any case, thanks for this library and the quick support.

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

No branches or pull requests

2 participants