On Thursday, September 18, 2014 2:31:14 PM UTC-5, Johan Sigfrids wrote:
>
> So I was looking at allocations in some code and I noticed I sped things 
> up significantly by changing map to a list comprehension. Doing some 
> microbenchmarking I noticed that map allocates far more memory than a list 
> comprehension. Shouldn't they essentially be doing the same thing?
>

map() is a generic function call, and doesn't specialize on parameter 
values. The list comprehension is special syntax. The following should be 
instructive:

code_llvm(f1, (Array{Float64, 1},))

vs.

code_llvm(f2, (Array{Float64, 1},))

Making map() fast is one of the nearish-term goals. The latest discussion 
on map-related topics starts here: 
https://github.com/JuliaLang/julia/issues/8389#issuecomment-55930448

Reply via email to