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

Avoid using ArrayList in MonotoneChain builders #467

Merged
merged 3 commits into from
Aug 30, 2019

Conversation

dr-jts
Copy link
Contributor

@dr-jts dr-jts commented Aug 30, 2019

As discussed in #463, currently MonotoneChain construction uses a temporary ArrayList to accumulate int index values. This causes unnecessary object allocation, and may be slower (although this is not certain).

The use of ArrayList is avoided in two ways:

  • MonotoneChainBuilder can be refactored to avoid using a array of indexes completely, by constructing MonotoneChain objects as they determined
  • In MonotoneChainIndexer the return of an int[] is required, but it is changed to use a new utility class IntArrayList. This class uses primitive int values, and so should have less memory pressure than an ArrayList of Integer

Signed-off-by: Martin Davis <mtnclimb@gmail.com>
Signed-off-by: Martin Davis <mtnclimb@gmail.com>
Signed-off-by: Martin Davis <mtnclimb@gmail.com>
@dr-jts dr-jts merged commit 63406b8 into locationtech:master Aug 30, 2019
@dr-jts dr-jts deleted the improve-mcbuilder branch August 30, 2019 17:51
pramsey added a commit to pramsey/geos that referenced this pull request Sep 4, 2019
MonotoneChainBuilder can be refactored to avoid using
an array of indexes completely, by constructing
MonotoneChain objects as they determined.
strk pushed a commit to libgeos/geos that referenced this pull request Sep 4, 2019
an array of indexes completely, by constructing
MonotoneChain objects as they determined.
locationtech/jts#467
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant