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 decomposing clip calls #8

Open
tcql opened this issue May 6, 2015 · 2 comments
Open

optimize decomposing clip calls #8

tcql opened this issue May 6, 2015 · 2 comments
Labels

Comments

@tcql
Copy link
Owner

tcql commented May 6, 2015

Because clipping with GH means decomposing to pairwise clip calls, there's a lot of looping and array modification in some of the operations. This can result in very slow operations when you have complex inputs, such as very large multipolygons.

I think we could optimize this a lot by doing some checks before looping over and clipping shapes multiple times. For instance, I think we could detect whether two shapes are touching in advance, and maybe even keep an internal index of shape relationships internally so consecutive internal GH calls won't have to do lots of useless legwork.

@tcql tcql added the optimize label May 7, 2015
@mourner
Copy link
Contributor

mourner commented May 11, 2015

Looking at the code, I think the biggest optimization you can make is getting rid of pretty much ALL array cloning, slicing and splicing. Given that you convert arrays to linked lists in the GH call itself, you can refactor the code in such a way so that you convert rings once outside and then operate them without the need to do needless copy of data.

@tcql
Copy link
Owner Author

tcql commented May 11, 2015

👍 I was just talking to @morganherlocker about this the other day. I'm
also pretty sure that in the current state, cloning is not necessary for
most of the operations anyway, so this should definitely clean stuff up &
give some perf boost

@tcql tcql mentioned this issue Dec 21, 2015
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants