You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that conv is slower than necessary. By implementing a naive convolution, I am able to outperform conv for moderate vector sizes. On my particular machine, naive convolution is better than conv if the product of vector sizes is less than 100 000.
Just so everyone sees what the naive solution is, I'm pasting it below.
slowconvcost(m,n) =2e-9*m*n+1e-6fastconvcost(m,n) =7e-8*(m+n)*log(m+n)+1e-4functionsebconv(a::Array{T}, b::Array{T}) where T
m =length(a)
n =length(b)
if(fastconvcost(m,n)<slowconvcost(m,n)) returnconv(a,b); end
c =zeros(T,m+n-1)
@inboundsfor j=1:m
for k=1:n
c[j+k-1] += a[j]*b[k]
endendreturn c
end
Here is a performance plot:
Edit: tweaked code for better heuristic as to when slowconv is faster than fastconv.
The text was updated successfully, but these errors were encountered:
Moved from JuliaLang/julia#13996 (more discussion there)
It seems that
conv
is slower than necessary. By implementing a naive convolution, I am able to outperformconv
for moderate vector sizes. On my particular machine, naive convolution is better thanconv
if the product of vector sizes is less than 100 000.Just so everyone sees what the naive solution is, I'm pasting it below.
Here is a performance plot:
Edit: tweaked code for better heuristic as to when slowconv is faster than fastconv.
The text was updated successfully, but these errors were encountered: