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

optimized SimpleEleConstraintEnforcer.addConnectors (O(n^2) to O(nlogn)) #188

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

spinachpasta
Copy link

SimpleEleConstraintEnforcer.addConnectors has been the performance bottleneck (some large osm files took me 30 hours to be processed!), because it has O(n^2) loop to find points at the same coordinates.
I replaced O(n^2) loop to Kd-tree algorithm which is O(n logn).
This resulted in a huge performance improvement.

In my test cases, the performance was improved from 2000ms to 65ms.

@spinachpasta spinachpasta changed the title optimized SimpleEleConstraintEnforcer.addConnectors optimized SimpleEleConstraintEnforcer.addConnectors (O(n^2) to O(nlogn)) Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant