slow booleanOverlap performance vs very fast booleanWithin
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
Hi,
I'm using the latest npm turf modules browserified. The code I created compares many geometries to eachother, trying to find geometries that are within others is really fast in the browser. crosschecking 3000 polygons vs itself is super fast , less than 1 second in chrome. (linux platform)
I added the same check , same code with booleanOverlap and it almost takes a minute to run over this same set (excluding testing the positive matches found with booleanWithin. The fans kick in, the CPU goes 170%.
Is there a known issue with the efficiency / performance of booleanOverlap ? Can I help analyse / assist in finding a more optimized way ? Is this by nature a hard math job to do ?
And lastly, are there any alternative approaches to detect polygons that partially overlap ?
Thanks for turf.js too, it's pretty awesome to work with. Let me know if I can help
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported comparison using booleanOverlap and booleanWithin on roughly 3,000 polygons in the browser, then inspect the booleanOverlap and booleanWithin module entry points. Compare their operation counts and profiling results; done means identifying a concrete performance cause and documenting a reproducible benchmark with improved results or a confirmed algorithmic limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100