Re: [julia-users] Re: Debugging stack allocation

2016-09-22 Thread Yichao Yu
On Thu, Sep 22, 2016 at 8:44 AM, Jamie Brandon wrote: > Well, I managed to answer the first part of my question. A variable won't be > stack-allocated unless the compiler can prove it is always defined before > being used. Mine were, but the control flow was too

[julia-users] Re: Debugging stack allocation

2016-09-22 Thread Jamie Brandon
Well, I managed to answer the first part of my question. A variable won't be stack-allocated unless the compiler can prove it is always defined before being used. Mine were, but the control flow was too complex for the compiler to deal with. I added `local finger = Finger{1}(0,0)` in a few places

[julia-users] Re: Debugging stack allocation

2016-09-22 Thread Jamie Brandon
Oh, for comparison, this simper function contains no heap allocation at all, so the compiler is definitely willing to do this under some circumstances. function foo() finger = Finger{1}(1,1) for _ in 1:1000 finger = Finger{1}(finger.hi + finger.lo, finger.lo) end finger end On 22