Using calloc could reduce this significantly since the kernel can lazily fill 
zero pages only when you access them. 


> On Nov 24, 2014, at 3:01 PM, David Smith <[email protected]> wrote:
> 
> To add some data to this conversation, I just timed allocating a billion 
> Int64s on my macbook, and I got this (I ran these multiple times before this 
> and got similar timings):
> 
> julia> N=1_000_000_000 
> 1000000000 
> 
> julia> @time x = Array(Int64,N); 
> elapsed time: 0.022577671 seconds (8000000128 bytes allocated) 
> 
> julia> @time x = zeros(Int64,N); 
> elapsed time: 3.95432248 seconds (8000000152 bytes allocated) 
> 
> So we are talking adding possibly seconds to a program per large array 
> allocation.
> 
> 
> 

Reply via email to