[julia-users] Re: Why does map allocate so much more than a list comprehension?

2014-09-22 Thread Jason Merrill
On Monday, September 22, 2014 4:46:31 PM UTC-7, Carlos P wrote: > > and inlining the function seems to allocate even much more memory (almost > 25 times more)... > Any reason why? > > data = rand(10^6) > f1(data) = [sin(i) for i in data] > > julia> @time f1(data); > elapsed time: 0.023104734 secon

[julia-users] Re: Why does map allocate so much more than a list comprehension?

2014-09-22 Thread Carlos P
and inlining the function seems to allocate even much more memory (almost 25 times more)... Any reason why? data = rand(10^6) f1(data) = [sin(i) for i in data] julia> @time f1(data); elapsed time: 0.023104734 seconds (8000128 bytes allocated) julia> @time [sin(i) for i in data]; elapsed time: 1

[julia-users] Re: Why does map allocate so much more than a list comprehension?

2014-09-18 Thread Patrick O'Leary
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