Possible optimization for list comprehension using map?

118 views
Skip to first unread message

catc...@bromberger.com

unread,
Jun 17, 2015, 9:24:35 AM6/17/15
to juli...@googlegroups.com

Sorry if this counts as a cross-post, but I have some more information.

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

but recently evaluated 
foo(g, a) = map(x->Pair(x, g), a)as an alternative.

It turns out that the list comprehension is slower (and, from the code_native, more complex) than the map.


Are these two functions equivalent?

catc...@bromberger.com

unread,
Jun 17, 2015, 12:16:10 PM6/17/15
to juli...@googlegroups.com
Closing this out in favor of the discussion at https://groups.google.com/d/msg/julia-users/QMEvSThtXGI/RJlKuIsThl8J. Sorry for the noise.
Reply all
Reply to author
Forward
0 new messages