-
Notifications
You must be signed in to change notification settings - Fork 165
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
Improve geos multipolygon creation performance #251
Improve geos multipolygon creation performance #251
Conversation
af133c0
to
bbef1ec
Compare
Looking at history of the @Quiwin knowing your sources, I guess your I'm more in favor than not : it seems genuinely better. @keithdoggett do you know the historical reason there, or do you think we should ping Daniel ? Also about the failing tests, we should work on that asap ! |
if (collection && | ||
type == GEOS_MULTIPOLYGON | ||
&& (factory_data->flags & 1) == 0 | ||
&& (GEOSisValid_r(geos_context, collection) == 0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small cosmetic change that feels clearer !
if (collection && | |
type == GEOS_MULTIPOLYGON | |
&& (factory_data->flags & 1) == 0 | |
&& (GEOSisValid_r(geos_context, collection) == 0)) { | |
if (collection | |
&& type == GEOS_MULTIPOLYGON | |
&& !(factory_data->flags & 1) | |
&& !GEOSisValid_r(geos_context, collection)) { |
Looks good! I'm not sure of the historical purpose of those extra checks. It seems that @BuonOmo are all of the checks failing because of a floating-point comparison issue? I think I have a fix for that in the v3-dev branch we can probably cherry-pick. |
As discussed over the phone with @keithdoggett, we should merge this one into the v3-dev to avoid having to backport of all @keithdoggett's work on floating point issues. @Quiwin could you rebase on this branch and we'll merge it there. That will be one more great reason for using rgeo 3.0 😄 And could you also add a note to the changelog ? (History.md file) |
f1482c1
to
d330b27
Compare
d330b27
to
f1482c1
Compare
f1482c1
to
338331b
Compare
@BuonOmo Done :) |
Replace a manual validity check on MultiPolygon, which was iterating on each polygon combination, by a direct call of geos isValid.
338331b
to
77e543c
Compare
77e543c
to
61f0ec3
Compare
Replace a manual validity check on MultiPolygon, which was iterating on each polygon combination, by a direct call of GEOSisValid.
Replace a manual validity check on MultiPolygon, which was iterating on each polygon combination, by a direct call of GEOSisValid.
Replace a manual validity check on MultiPolygon, which was iterating on each polygon combination, by a direct call of GEOSisValid.
Replace a manual validity check on MultiPolygon, which was iterating on each polygon combination, by a direct call of GEOSisValid.
Replace a manual validity check on MultiPolygon, which was iterating on
each polygon combination, by a direct call of geos isValid.
Summary
Hello !
MultiPolygon creation was slower than expected on large MultiPolygon, it was due to an old check for validity which manually iterated on every polygon combination of the given multiPolygon.
Now directly call geos to check for validity.
Other Information
Tested with above geojson:
Before: 1.95 sec
After: 0.35 sec
I couldn't find the exact geos issue it tried to avoid
but I dont think there is much risk since the previous code written to circumvent it was more than 11 years ago c44767e
Thanks!