Did you run this inside a function? If not, your results are not going to be useful indicators of how code will perform inside a function.
Inside of a function body, I see 0 bytes being allocated. -- John On Dec 1, 2014, at 4:53 PM, Yijing Wu <[email protected]> wrote: > Hi all, I found a strange problem about a very simple code in julia and > hopefully I can get some help from you, here is the code: > > > B=[1:1000] > T=zeros(Int64,1000) > for i=1:1000 > @time T[i]=B[i] > println(T[i]) > end > > And when I run the code, the @time shows that it require 48 bytes allocation > when i is larger than or equal to 512, and 0 bytes when smaller. Is this a > problem that can be improved or I have to accept that it is designed to take > some allocations when larger than 512? > > Thanks a lot for your help! >
