Are you timing things in the global scope?

 -- John

On Dec 19, 2014, at 1:00 PM, John Drummond <john...@gmail.com> wrote:

> For the following code (julia 0.3.3 in windows 7 ) I don't understand what 
> the bytes allocated in @time means
> 
> All I'm doing each time is adding 10  8 byte integers
> 
> Thanks for any thoughts
> 
> julia> @time c = [1,2]
> elapsed time: 3.32e-6 seconds (144 bytes allocated)
> 2-element Array{Int64,1}:
>  1
>  2
> 
> julia> sizeof(c)
> 16
> 
> 
> julia> @time for x in 30:39 push!(c, x) end
> elapsed time: 2.717e-6 seconds (256 bytes allocated)
> 
> julia> @time for x in 30:39 push!(c, x) end
> elapsed time: 2.717e-6 seconds (288 bytes allocated)
> 
> julia> @time for x in 30:39 push!(c, x) end
> elapsed time: 2.112e-6 seconds (0 bytes allocated)
> 
> julia> @time for x in 30:39 push!(c, x) end
> elapsed time: 3.321e-6 seconds (640 bytes allocated)
> 
> julia> sizeof(c)
> 336

Reply via email to