I am trying to figure out the most efficient way to perform in-place array 
operations in Julia.

julia> a=rand(10000,10000)

julia> tic(); b=sin(a); toc(); 
elapsed time: 1.25738114 seconds 

julia> tic(); map!(sin,a); toc(); 
elapsed time: 7.821650464 seconds 

julia> tic(); for i=1:length(a); a[i]=sin(a[i]); end; toc(); 
elapsed time: 24.993171377 seconds 

Nothing seems faster than creating a new array, which I'd like to avoid 
without slowing down the code if possible.

Any ideas?

Reply via email to