hurst and runmad slow
Opened this issue · 2 comments
hi
thanks for putting together this package. I run a series of technical analysis on stocks. If I run without hurst and runmap, it comes out to 4 seconds for 50 stocks, however, if I add these both, the time increases to 35 seconds!
I am using Julia 1.5 and the latest version of indicators
I am afraid I cant seem to print the profile trace. the issue seems to be:
function estimate_hurst(x::Array{T}; intercept::Bool=false)::T where {T<:Real} RS = genrsdata(x)
rsdata = [rsdata; genrsdata(a)] rsdata = [rsdata; genrsdata(b)]
Also, I noticed that if I replace the Close with the below, it now takes close to 9 seconds!
Close = 100.0 .+ cumsum(randn(n))
Any thoughts please?
thanks
Roh
Hey @Roh-codeur, thanks for bringing this forward. I definitely want to make sure the code is efficient as possible, so I appreciate you pointing out a potential improvement that could be made.
Could you provide some more context to help me figure out how to solve what could be causing the lag?
- What does the rest of the code you are using look like? For example, what parameters are you using?
- What is the nature of the dataset you're running against? For example, what variable types are you using? How long do the historical samples for the assets in the universe tend to be?
I tried testing both hurst
and runmad
on a 50-asset universe with historical prices starting in 2001 and wasn't able to replicate the kind of performance drag you seem to be experiencing, so some more information like the above might help me figure it out.
@dysonance : Sorry, forgot to reply earlier. on my machine the below code takes 0.34 seconds. the issue is not with length of x, it seems to be with the value of "n"
using Indicators N = 365*8 x = cumsum(randn(N)) @time hurstInd = hurst(x; n = 200)