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 Polygon subdivision #2309

Merged
merged 5 commits into from
Dec 5, 2014
Merged

Optimize Polygon subdivision #2309

merged 5 commits into from
Dec 5, 2014

Conversation

bagnell
Copy link
Contributor

@bagnell bagnell commented Dec 4, 2014

Increases performance and reduces memory allocations. The times in the table below are in ms.

Polygons master This branch
US states 59.7 43.4
US counties 930.4 257.4
Countries 10747.2 5620.7

if (g0 === max) {
edge = Math.min(triangle.i0, triangle.i1).toString() + ' ' + Math.max(triangle.i0, triangle.i1).toString();
edge = Math.min(i0, i1) + ' ' + Math.max(i0, i1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we would get a performance gain by optimizing this key to avoid the string, e.g., a floating-point value that is min.max or a more efficient data structure than just using a JavaScript object as a hash lookup?

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 5, 2014

@bagnell is there anything else you want to try before we merge.

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 5, 2014

CC #2179

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 5, 2014

We're looking at a new subdivision algorithm, but will merge this improvement in the meantime.

pjcozzi added a commit that referenced this pull request Dec 5, 2014
@pjcozzi pjcozzi merged commit c71f81c into master Dec 5, 2014
@pjcozzi pjcozzi deleted the subdivision branch December 5, 2014 19:12
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