Thanks. Forgot to say that I am using v"0.5.0-rc1+0". @time tells me that m1 allocates a lot. I understand that using zip for this purpose is suboptimal, I just want to understand why it does not scale, because I find zip convenient for a lot of idioms.
On Wed, Aug 10 2016, Tomas Lycken wrote: > For completeness: I can reproduce this behavior for m1. m2 returns fine > after a little over four times the time it took for 100 vectors. > > // T > > On Wednesday, August 10, 2016 at 11:34:08 AM UTC+2, Tamas Papp wrote: >> >> I was benchmarking code for calculating means of vectors, eg >> >> v = [rand(100) for i in 1:100] >> >> m1(v) = map(mean, zip(v...)) >> m2(v) = mapslices(mean, hcat(v...), 2) >> >> @elapsed m1(v) >> @elapsed m2(v) >> >> m2 is faster, but for 1000 vectors, >> >> v = [rand(100) for i in 1:1000] >> >> m1 with zip takes "forever" (CPU keeps running at 100%, I interrupted >> after a 10 minutes). Is this supposed to happen, or should I report it >> as a bug? >> >> Tamas >>