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

Concurrent HashMap #2

Closed
dadhi opened this issue Jul 31, 2017 · 4 comments
Closed

Concurrent HashMap #2

dadhi opened this issue Jul 31, 2017 · 4 comments

Comments

@dadhi
Copy link
Owner

dadhi commented Jul 31, 2017

  1. Fix concurrent update to work as expected in all cases, proove it
  2. Improve on current linear probing version to the max
  3. Experiment with new impl., e.g. leap-frog probing

Update

Here is the existing implementation to copy and adapt Ariadne

Test and verify via RelaSharp.

Update 2

Here is the Fibonacci Hashing reveal to fit hash into smaller space, instead of current modulo approach:
https://probablydance.com/2018/06/16/fibonacci-hashing-the-optimization-that-the-world-forgot-or-a-better-alternative-to-integer-modulo/

@dadhi
Copy link
Owner Author

dadhi commented Aug 3, 2017

Results so far:

image

@dadhi
Copy link
Owner Author

dadhi commented Aug 12, 2017

Concurrent HashMaps are hard, harder and hardest.

1.

How to calculate original slots count (capacity) from capacity+1/4buffer.

Say the count is 32+8==40, 0b101000
Then the original count 32 == 40 & (40 << 2)

2.

How to put an item into map during resizing without loss:

  • Check if transit slots exist, then Remove from current slots and insert into transit. The copying thread will do that backwards: will copy into transit slot, than remove from old.

  • Remove is similar: remove from current slots first then remove transit slot if copied.

@dadhi
Copy link
Owner Author

dadhi commented Aug 12, 2017

3.

Double expand size is simple.:

Given 32+8==40, do 40 << 1 == 64+16 == 80

@dadhi dadhi changed the title Faster concurrent HashMap Concurrent HashMap Oct 1, 2017
@dadhi
Copy link
Owner Author

dadhi commented Apr 15, 2019

Not now

@dadhi dadhi closed this as completed Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant