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

Huge performance optimization: re-use the distances computed when making a recurrence matrix #143

Open
Datseris opened this issue Feb 20, 2023 · 0 comments
Labels
good first issue An easy issue, suitable for new contributors. high priority This needs to be done soon! performance

Comments

@Datseris
Copy link
Member

Alright, we stand to gain MASSIVE, 2x, performance benefit here for all RecurrenceTypes except RecurrenceThreshold. Take a look at our source code that computes the recurrence threshold for a given type: https://github.com/JuliaDynamics/RecurrenceAnalysis.jl/blob/main/src/matrices/recurrence_specification.jl#L78-L153

For all types (besides RecurrenceThreshold) we are computing all the distances across all pairs of points, to estimate a threshold. Then, we give this threshold to the low-level recurrence_matrix function which computes all distances all over again. We can be much smarter than that and just store somewhere the distance matrtix and pass it around until we reach the recurrence_matrix function, which then does a trivial boolean conversion rmat = dmat .< threhold; return SparseMatrix(rmat).

This is such a simple code base improvement with such a massive impact.

@Datseris Datseris added performance good first issue An easy issue, suitable for new contributors. high priority This needs to be done soon! labels Feb 20, 2023
@Datseris Datseris pinned this issue Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue An easy issue, suitable for new contributors. high priority This needs to be done soon! performance
Projects
None yet
Development

No branches or pull requests

1 participant