Ah. Yes.
Though I was only really interested initially in what happened with the 
memory.
putting it in a let clause gives me
julia> let
       @time c = [1,2]
       sizeof(c)
       @time for x in 30:39 push!(c, x) end
       @time for x in 30:39 push!(c, x) end
       @time for x in 30:39 push!(c, x) end
       @time for x in 30:39 push!(c, x) end
       sizeof(c)
       end
elapsed time: 1.811e-6 seconds (64 bytes allocated)
elapsed time: 3.018e-6 seconds (256 bytes allocated)
elapsed time: 1.207e-6 seconds (288 bytes allocated)
elapsed time: 6.03e-7 seconds (0 bytes allocated)
elapsed time: 2.113e-6 seconds (640 bytes allocated)
336

with a difference only for the initial creation which is presumably the 
global versus local difference.


On Friday, December 19, 2014 6:01:24 PM UTC, John Myles White wrote:
>
> Are you timing things in the global scope? 
>
>  -- John 
>
> On Dec 19, 2014, at 1:00 PM, John Drummond <[email protected] <javascript:>> 
> 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