Open
Conversation
SAHashMap isn't quite a port of HashMap to StructuredArray. While HashMap overflows to a red–black tree SAHashMap does not. This makes performance comparisons problematic since different code is tested. Directly porting HashMap to StructuredArray is not possible since the table in HashMap is heterogeneous but needs to be homogeneous for StructuredArray. The compromise implemented in this change is to store the red–black tree in the next node instead of the node in the table. This commit includes the following changes: - sync code based on JDK 8u92, also includes indentation - store a red–black tree in the next node if there are too many overflows - remove the sentinel flag on Node, use a sentinel object in the key due to padding this should save two words per entry and bring memory consumption in line with HashMap this may help performance - HashIterator, KeySpliterator, ValueSpliterator, EntrySpliterator were missing a few sentinel checks - SAAbstractMap seems kinda pointless but was left it in and synched Unfortunately the code could use more testing in the areas of tree corner cases and streams.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SAHashMap isn't quite a port of HashMap to StructuredArray. While
HashMap overflows to a red–black tree SAHashMap does not. This makes
performance comparisons problematic since different code is tested.
Directly porting HashMap to StructuredArray is not possible since the
table in HashMap is heterogeneous but needs to be homogeneous for
StructuredArray. The compromise implemented in this change is to store
the red–black tree in the next node instead of the node in the table.
This commit includes the following changes:
overflows
due to padding this should save two words per entry and bring memory
consumption in line with HashMap
this may help performance
missing a few sentinel checks
Unfortunately the code could use more testing in the areas of tree
corner cases and streams.