Hi Deniz,

If you time things in the global scope, you will come to incorrect conclusions 
about performance. If you want to do performance comparisons, you need to do 
them inside of a function body to get meaningful results.

 — John

On Nov 30, 2014, at 9:24 AM, Deniz Yuret <denizyu...@gmail.com> wrote:

> 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