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

Optimise sorting #143

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Optimise sorting #143

wants to merge 3 commits into from

Conversation

oameye
Copy link
Member

@oameye oameye commented Jan 3, 2024

The align_pair function in the sorting.jl file can be optimized in the following ways:

  • Avoid unnecessary computations: You're computing the sortperm of the entire distances matrix, which is an O(n^2) operation. However, you only need the minimum distance for each reference, which can be found in O(n) time.

  • Use efficient data structures: You're using arrays to keep track of which elements have been matched. Consider using a Set for this, which has O(1) lookup time.

From
image
to
image

@oameye oameye added the performance Regarding performance of the package label Jan 3, 2024
@oameye oameye marked this pull request as draft January 3, 2024 15:46
@jkosata
Copy link
Member

jkosata commented Jan 13, 2024

Nice find! Has this part even been a bottleneck btw?

@oameye
Copy link
Member Author

oameye commented Jan 13, 2024

Yeah If I profilled this was the bottleneck but it seems that I am doing something wrong. The end result is not sorted properly. So I will have to look at it again anyway another time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Regarding performance of the package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants