You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have pointed this out in a discussion of my pull-request on DataStructures.jl, and I also submitted a related documentation issue, but maybe it should be a Julia issue too. For the function
functiontestref1(m)
a = [3.0, 4.0, 5.0]
sm =0.0for i =1: m
q =Ref(a,1)
sm += q[]
endend
Notice the huge memory allocation. The reason is that the object q is allocated on the heap rather than the stack. This behavior suggests that Ref(array,index) should not be used in an inner loop of a high-performance code.
The text was updated successfully, but these errors were encountered:
I have pointed this out in a discussion of my pull-request on DataStructures.jl, and I also submitted a related documentation issue, but maybe it should be a Julia issue too. For the function
I get the following timing result:
Notice the huge memory allocation. The reason is that the object q is allocated on the heap rather than the stack. This behavior suggests that Ref(array,index) should not be used in an inner loop of a high-performance code.
The text was updated successfully, but these errors were encountered: