The devectorized code below should be much faster than equivalent vectorized code, according to "Fast Numeric Computation in Julia <http://julialang.org/blog/2013/09/fast-numeric/>" on the official julialang.org web site. But I find just the opposite!
julia> x = randn(10000000); > julia> y = randn(10000000); > julia> r = zeros(10000000); > julia> @time r[:] = exp(-abs(x-y)); > elapsed time: 1.233813455 seconds (320000432 bytes allocated, 14.20% gc > time) > julia> @time for i = 1:length(x) > r[i] = exp(-abs(x[i]-y[i])) > end > elapsed time: 10.326934093 seconds (1599983704 bytes allocated, 21.29% gc > time) Can someone explain what's going on? The devectorized version appears to allocate 5x as much memory. Thanks much!
