Skip to content

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