Performance of creating S2Loops\S2Polygons, takes loads of CPU time...

Skip to first unread message

Michael Brichko

Feb 17, 2020, 2:09:17 PM2/17/20
to s2geometry-io

I'm, looking into a scenario of creation of millions of polygons (let's say S2Loops) and querying every polygon for just 1 point containment and I noticed a big overhead for polygon creation, it seems to be a very expensive operation.

1. Do you have any tips for such scenario ?

2. Polygon creation also creates an index of that polygon and in my case I don't need it (just 1 query), it seems that I can get rid of this and reduce CPU time for polygon creation 8 times less. What are your thoughts ? Are there any more improvements that I can apply ? 

3. Do you guys plan to maybe add a more formal support for my case ? Because S2Loop\S2Polygon creation is very expensive CPU time operation.

4. Another very expensive part of S2Loop creation is "S2LatLngRect bound_" initialization, any thoughts on this ?

I've received a very good results once I removed the dependency on index & bound_ but without the bound_ point containment query returns bad results which is a bit surprising because I thought that bound_ should be an improvement for the case where there are millions of queries, it turns out that it's part of the logic. Any thoughts on this ?

Thanks a lot !
Reply all
Reply to author
0 new messages