-
Notifications
You must be signed in to change notification settings - Fork 1
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
Improved performance #5
Comments
This will probably benefit from the refactoring in #2 |
Idea: since, |
Questions for current benchmark test Why are there so many allocations? |
My earlier idea turns out to be the case: for It is probably not necessary to use a tuple, I think a lazy array type that just artificially broadcasts across the channels should do fine. |
I've convinced myself that there are likely not any type instabilities in the code well enough that I think it is worth seeing how performance improves if I avoid array views. There still could be an issue with AxisArrays, and it would be worth attempting some code that avoids them (currently they are always used) just to see how that goes, if removing the array views doesn't work. |
There is still a type instability: julia> z = mix(x,y) |> tosamplerate(1000Hz)
julia> @trace SignalOperators.sampleat!(out,z,SignalOperators.SignalTrait(z),1,1,checks[5]) modules=[SignalOperators]
┌ Warning: dynamic dispatch to SignalOperators.writesink!(SignalOperators.one_sample, 1, %new(FillArrays.Fill{Float64,1,Tuple{Base.OneTo{Int64}}}, 0.0, Core.tuple(%new(Base.OneTo{Int64}, Base.ifelse(Base.slt_int(Base.arraysize(Base.getfield(Base.getfield(Base.getfield(Base.getfield(x, padded_signals), 1, $(Expr(:boundscheck))), signal), data), 2), 0), 0, Base.arraysize(Base.getfield(Base.getfield(Base.getfield(Base.getfield(x, padded_signals), 1, $(Expr(:boundscheck))), signal), data), 2))))))
└ @ ~/Documents/work/projects/SignalOperators/src/mapsignal.jl:-1
┌ Warning: dynamic dispatch to SignalOperators.writesink!(SignalOperators.one_sample, 1, %new(AxisArrays.AxisArray{Float64,1,SubArray{Float64,1,Array{Float64,2},Tuple{Int64,Base.Slice{Base.OneTo{Int64}}},true},Tuple{AxisArrays.Axis{:channel,UnitRange{Int64}}}}, %new(SubArray{Float64,1,Array{Float64,2},Tuple{Int64,Base.Slice{Base.OneTo{Int64}}},true}, Base.getfield(Base.getfield(Base.getfield(Base.getfield(x, padded_signals), 2, $(Expr(:boundscheck))), signal), data), Core.tuple(j, %new(Base.Slice{Base.OneTo{Int64}}, %new(Base.OneTo{Int64}, Base.ifelse(Base.slt_int(Base.arraysize(Base.getfield(Base.getfield(Base.getfield(Base.getfield(x, padded_signals), 2, $(Expr(:boundscheck))), signal), data), 2), 0), 0, Base.arraysize(Base.getfield(Base.getfield(Base.getfield(Base.getfield(x, padded_signals), 2, $(Expr(:boundscheck))), signal), data), 2))))), Base.sub_int(Base.add_int(Base.add_int(1, Base.mul_int(Base.sub_int(j, 1), 1)), Base.mul_int(0, Base.mul_int(1, Base.sub_int(Base.ifelse(Base.slt_int(Base.arraysize(Base.getfield(Base.getfield(Base.getfield(Base.getfield(x, padded_signals), 2, $(Expr(:boundscheck))), signal), data), 1), 0), 0, Base.arraysize(Base.getfield(Base.getfield(Base.getfield(Base.getfield(x, padded_signals), 2, $(Expr(:boundscheck))), signal), data), 1)), 0)))), Base.mul_int(Base.mul_int(1, Base.sub_int(Base.ifelse(Base.slt_int(Base.arraysize(Base.getfield(Base.getfield(Base.getfield(Base.getfield(x, padded_signals), 2, $(Expr(:boundscheck))), signal), data), 1), 0), 0, Base.arraysize(Base.getfield(Base.getfield(Base.getfield(Base.getfield(x, padded_signals), 2, $(Expr(:boundscheck))), signal), data), 1)), 0)), 1)), Base.mul_int(1, Base.sub_int(Base.ifelse(Base.slt_int(Base.arraysize(Base.getfield(Base.getfield(Base.getfield(Base.getfield(x, padded_signals), 2, $(Expr(:boundscheck))), signal), data), 1), 0), 0, Base.arraysize(Base.getfield(Base.getfield(Base.getfield(Base.getfield(x, padded_signals), 2, $(Expr(:boundscheck))), signal), data), 1)), 0))), Core.tuple(Base.getfield(Base.getfield(Base.getfield(Base.getfield(Base.getfield(x, padded_signals), 2, $(Expr(:boundscheck))), signal), axes), 2, true))))
└ @ ~/Documents/work/projects/SignalOperators/src/mapsignal.jl:-1
2-element Array{Float64,1}:
0.3300021471853958
0.8360567643791674 |
This prior issues turned out to be because of a number of different sources of memory allocation during |
Closed by e0ec3f0 |
I'm slowly working through benchmarks to make sure each
sampleat!
implementation is entirely stack based.Types to check
until
andafter
pad
,append
mapsignal
and derivativesfiltersignal
and derivativesThe text was updated successfully, but these errors were encountered: