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

Optimize reverse neighbors for memory #590

Merged
merged 2 commits into from
Oct 5, 2020

Conversation

mtdowling
Copy link
Member

This method previously needed lots of intermediate representations
stored in memory to create a Map<ShapeId, List> that
contains only unique relationships. It was done using Stream,
distinct, and groupingBy. However, when trying to load ridiculously
large models, that approach consume tons of heap. This approach
allocates as little as possible (I think), but does require creating
an ArrayList copy of a Set each time neighbors are returned.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

This method previously needed lots of intermediate representations
stored in memory to create a Map<ShapeId, List<RelationShip>> that
contains only unique relationships. It was done using Stream,
distinct, and groupingBy. However, when trying to load ridiculously
large models, that approach consume tons of heap. This approach
allocates as little as possible (I think), but does require creating
an ArrayList copy of a Set each time neighbors are returned.
@mtdowling mtdowling requested a review from srchase October 5, 2020 18:33
Co-authored-by: Chase Coalwell <[email protected]>
@mtdowling mtdowling requested a review from srchase October 5, 2020 18:49
@mtdowling mtdowling merged commit acc7c95 into master Oct 5, 2020
@mtdowling mtdowling deleted the optimize-reverse-provider-memory branch December 11, 2020 17:59
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.

2 participants