I don’t know. I can’t reproduce your results. Here’s what I see with Julia 0.4:
julia> A=rand(5000,5000);
julia> B=rand(5000,5000);
julia> for i=1:10
@time A*B;
end
elapsed time: 8.034742507 seconds (226166452 bytes allocated)
elapsed time: 7.823044437 seconds (200000112 bytes allocated)
elapsed time: 8.231567795 seconds (200000112 bytes allocated)
elapsed time: 7.492245174 seconds (200000112 bytes allocated)
elapsed time: 7.791351513 seconds (200000112 bytes allocated)
..
— John
On Nov 28, 2014, at 3:49 PM, Carlos Baptista <[email protected]> wrote:
> Yes it is in the global scope. I entered everything right into the
> interpreter.
>
> I retried by creating functions:
>
> function multiply(A::Matrix, B::Matrix)
> @timeA*B
> end
>
> function benchmark(N::Int)
> A = rand(N, N)
> B = rand(N, N)
> for i=1:10
> multiply(A, B)
> end
> end
>
> benchmark(5000)
>
> elapsed time: 4.534866754 seconds (200000112 bytes allocated)
> elapsed time: 4.538866875 seconds (200000112 bytes allocated)
> elapsed time: 4.528996845 seconds (200000112 bytes allocated)
> elapsed time: 4.548095912 seconds (200000112 bytes allocated)
> elapsed time: 4.553692097 seconds (200000112 bytes allocated)
> elapsed time: 4.629964016 seconds (200000112 bytes allocated)
> elapsed time: 4.561603167 seconds (200000112 bytes allocated)
> elapsed time: 4.67098846 seconds (200000112 bytes allocated)
> elapsed time: 4.617811149 seconds (200000112 bytes allocated)
> elapsed time: 4.632597152 seconds (200000112 bytes allocated)
>
> So as you can see this way it works correctly. However I still do not get why
> my previous code that I ran in the global scope increased in run time. Could
> you explain that?