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

Reply via email to