JuliaDynamics/RecurrenceAnalysis.jl

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

開放

#143 建立於 2023年2月20日

 (0 則留言) (0 個反應) (0 位負責人)Julia (16 個分叉)auto 404
good first issuehigh priorityperformance

倉庫指標

星標
 (50 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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.

貢獻者指南