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

#2417 Explore reimplementing HashMap as CHAMP (Compressed Hash-Array Mapped Prefix-tree) #2745

Open
wants to merge 97 commits into
base: master
Choose a base branch
from

Conversation

wrandelshofer
Copy link

This is a draft intended for discussion.

This merge requests explores how a migration of the HAMT trie to a CHAMP trie could look like:

  • HashSet, HashMap: Replaces the internal HAMT data structure by a CHAMP data structure.
  • LinkedHashSet, LinkedHashMap: Replaces the internal HAMT+Seq data strucures by CHAMP+Vector data structures.
  • The changes are intended to affect the performance of vavr, but are not supposed to change any API.

The changes are somewhat sub-optimal and somewhat over-complicated, because I strived to not break any of the unit tests. (I believe that I should change a number of unit tests, because some rely on the iteration sequence of the HAMT implementation. However, the vavr API specifies that the iteration sequence is unspecified.)

The code is a port from the JHotDraw 8 collections module. https://github.com/wrandelshofer/jhotdraw8/tree/main/org.jhotdraw8.collection
The JHotDraw 8 collections are in turn a port of the 'capsule' collection library https://github.com/usethesource/capsule, and of vavr.

I do not expect that this draft can be merged in the current form. In JHotDraw 8 we have a mutable 'partner' collection for every immutable collection. This allows to test all immutable collections with the 'guava-testlib' library. Which provides very through tests. I did not want to change the API of vavr - so I have downgraded the mutable collections to transient collections. But I have not written new tests yet. So code coverage by unit tests is currently lower than I want it to be.

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

Successfully merging this pull request may close these issues.

None yet

1 participant