-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Encapsulate HPPC usage inside of ImmutableOpen(Int)Map (#80859)
This commit encapsulates a lot of the usage of HPPC into `ImmutableOpenMap` and `ImmutableOpenIntMap`. To accomplish this, this commit adds the `entrySet()` method to these classes returning `Set<Map.Entry<KType, VType>>`. This allows a map to be streamable using java Streams (`myMap.entrySet().stream()`) as well as ensuring that using a Java `foreach` loop **does not leak the underlying HPPC implementation outside of the ImmutableOpenMap**. This means that a variable could be switched from `ImmutableOpenMap` to `HashMap` without affecting the traversal of its contents. The rest of this PR is migrating usages of the HPPC iterators (`IntObjectCursor`, `ObjectCursor`, `ObjectObjectCursor`) to use `entrySet()` and regular java `Map.Entry<>` looping. I also ran benchmarks with Rally before and after these changes, and wasn't able to detect an appreciable difference between these. Subsequent work for this would involve migrating the rest of the Java source off of HPPC, and then experimenting with moving our collection use from `ImmutableObjectMap` to something like `HashMap`, or potentially backing `ImmutableObjectMap` with a built-in Java collection if we decided we want to keep it around. This PR was getting big enough that I felt it useful to open it as progress and for discussion rather than trying to do everything at once. Co-authored-by: Joe Gallo <[email protected]>
- Loading branch information
Showing
73 changed files
with
810 additions
and
638 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.