The first one is creating an array of arrays of Int8s while the other two appear to just be creating one array. Without more code, it's hard to tell.
> On May 10, 2014, at 9:09 PM, cnbiz850 <[email protected]> wrote: > > I tried to use comprehension in loops but found it somehow slower. In the > following example, the loop in first code is slower than in the second. > Would anyone please explain why? > > ======= > function ffcombs() > [Int8[i1,i2] for i1 in II, i2 in II] > end > > combs = ffcombs() > ii = zeros(Int8,2) > for ii in combs > ... > end > ========== > > for i1 in II, i2 in II > ... > end
