http://julia.readthedocs.org/en/release-0.3/manual/performance-tips/#avoid-global-variables

On Friday, October 10, 2014 10:56:36 PM UTC-5, David Smith wrote:
>
> This code runs in 0.5 sec in v0.3.2, but takes 0.64 s in v0.4:
> tic() 
> N = 256 
> n = 80 
> x = rand(N,N) + 1im*randn(N,N) 
> f = zeros(Complex128, N, N, n) 
> for t = 1:n 
>     f[:,:,t] = fft(x + float(t)) 
> end 
> toc()
>
> If I enclose it in a function, as in the following, and then run it by 
> calling the function, it runs in 0.3 s in both v0.3.2 and v0.4.
> function bench()
>     tic() 
>     N = 256 
>     n = 80 
>     x = rand(N,N) + 1im*randn(N,N) 
>     f = zeros(Complex128, N, N, n) 
>     for t = 1:n 
>         f[:,:,t] = fft(x + float(t)) 
>     end 
>     toc()
> end
> bench()
>
>
> What is going on?
>
>
>
>

Reply via email to