I have been using list comprehensions of the form
bar(g, a) = [Pair(x, g) for x in a] and [foo(x) for x in a]

but recently evaluated bar(g, a) = map(x->Pair(x, g),a) and map(x->foo(x),a)as 
substitutes.

It seems from some limited testing that map is slightly faster than the 
list comprehension, but it's on the order of 3-4% so it may just be noise. 
Allocations and gc time are roughly equal (380M allocations, ~27000MB, ~6% 
gc).

Should I prefer one approach over the other (and if so, why)?

Thanks!

Reply via email to