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

Multipolygon speed-up #66

Open
Sumbera opened this issue Jul 31, 2016 · 1 comment
Open

Multipolygon speed-up #66

Sumbera opened this issue Jul 31, 2016 · 1 comment

Comments

@Sumbera
Copy link

Sumbera commented Jul 31, 2016

While earcut is great for single polygon calculations, for multipolygon cases it could provide advanced API for more efficient working with Arrays:

  1. provide input params to work on data range for input data so earcut can work on single big user-pre-allocated array taking its slices (dStar, dEnd)
  2. provide input params to work on user pre-allocated triangles array as well, saving the results on specified offset and with correct index pointing to the data array being worked from dStart and dEnd.
  3. return new offset from writing new indices into the triangles.

all above is enabling to efficiently earcut hundreds of thousands polygons and passing the resulting arrays directly into the WebGL buffers.

I did that as experiment and saved hundreds of ms in total (for all polygons processing). Branch of this approach available here : https://github.com/Sumbera/earcut/tree/multipolygon

@napter
Copy link

napter commented Apr 18, 2019

Another vote for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants