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
Delete performance would benefit from improvement #17
Comments
@lkarlslund agreed regarding the performance of deletion, I will make deletion lazy in nature (items will be deleted during
Currently they are indistinguishable. One of the things in my TODO list was to reserve the first bit for all keyhashes to mark whether a node is deleted or not. Let me try this out then get back to you. |
I haven't looked at the internals, but it looks like you're pushing a deletion node before the node that should be deleted. Why not just mark this node for deletion directly? |
I will use index masking to use only the last 63 bits for comparison. Here is an example snippet for the same const mask uintptr = 1 << 63 - 1
// comparison
if a.KeyHash & mask > b.KeyHash & mask { // do something after comparison }
// check for deletion by checking the first bit
if a.KeyHash & (1 << 63) { println("item = deleted") }
This is also a great method but I would have to store an extra field In my opinion both methods are good, I will just check the performance of both approaches and then implement one. |
@lkarlslund deletion performance has improved for single elements with 5a39538 |
Very nice library for concurrent maps! For scenarios where you need to delete keys one at a time (not batching), the current performance makes it unusable.
I have an analysis application (https://github.com/lkarlslund/adalanche) and I've tried replacing some of the maps with yours (adding unsafe.Pointer in my fork).
With a nasty workaround where I don't delete keys, but set the value to a deleted flag, it works fairly good. But this is not the way.
Also looking at your code, I'm curious how you distinguish from a hash which is ^0 and the "marked" value which is the same?
The text was updated successfully, but these errors were encountered: