Skip to content

Conversation

markopy
Copy link
Contributor

@markopy markopy commented Oct 3, 2020

This speeds up single_linkage by about two orders of magnitude by using direct array access in fast_find which Cython can compile into a pure C loop.

I saw in the commit history that this was attempted before but abandoned due to unexplained crashes. The reason is that the current code is actually buggy and only works because python's wraparound indexing hides the problem. When using raw pointer access the bug leads to heap corruption and subsequent random crashes. A simple check to only label if we are not at the root already fixes this.

Also fixes #321 which should further improve overall performance.

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.

Possible improvement to path compression runtime
1 participant