geoarrow-rs icon indicating copy to clipboard operation
geoarrow-rs copied to clipboard

Add earcutr

Open deanm0000 opened this issue 1 year ago • 3 comments

I noticed that the deck.gl layers does earcut on the client but it'd be nice to create geometry source data that has already been earcutted for better performance. https://github.com/frewsxcv/earcutr

deanm0000 avatar Jun 24 '24 03:06 deanm0000

In theory we could bind to earcutr here, but it won't be that useful for deck.gl-layers. The output of earcut is a different length of data than the number of rows, so it doesn't really fit into an Arrow table or Parquet file. And on the frontend earcut is already done on 8 worker threads, so it's not a big slowdown

kylebarron avatar Jun 24 '24 15:06 kylebarron

I'm getting, what seems to be, significant time spent earcutting. Here's a profile...

image

I'm not sure what you mean about a different number of rows. I'm thinking that each row is its own polygon that gets earcut independently of other rows and so the new List that makes up the polygon will be a different length but I don't know why it'd be a different number of rows.

deanm0000 avatar Jun 24 '24 15:06 deanm0000

earcut should be on a separate worker by default https://github.com/geoarrow/deck.gl-layers/blob/25fdeafe2d9c591570bab975ebea43ae82e97a8d/src/solid-polygon-layer.ts#L69-L75.

kylebarron avatar Jun 24 '24 16:06 kylebarron