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

Investigate potential alternative data structures for s.c.i.HashCollision{Map,Set}Node #11164

Open
joshlemer opened this issue Sep 20, 2018 · 1 comment

Comments

@joshlemer
Copy link
Member

Currently HashMapCollisionNodes use an underlying Vector[(K, V)] to represent a hash collision bucket. However, we can probably achieve better performance using a mutable data structure, which the builder can take advantage of during a build phase.
The properties we are looking for are:

  • Very small memory overhead, there should not be big wasted space i.e. in the case of an ArrayBuffer
  • Should support the following operations
    • inPlaceUpdateByKeyOrElseAdd(key: Key, value: Value): Unit
      • upserts the key/value
      • order doesn't matter here, at the front/middle/back is fine for adding.
    • updateByKeyOrElseAdd(key: Key, value: Value): Unit
      • non-mutating form of the above, for use after builder publishes
    • inPlaceRemoveByKey(key: Key): Unit
    • removeByKey(key: Key): Unit
      • non-mutating form of the above, for use after builder publishes

I am personally leaning towards an unrolled linked list of some sort, since this would allow for very fast traversing, mutating, and prepending, as well as pretty-fast immutable updates, and very fast immutable prepends.

@joshlemer
Copy link
Member Author

When considering potential data structures, this issue should be kept in mind:
#11203

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

2 participants