Parallel loop, what wroong ? Parallel is slower then normal 

julia> @time for i=1:l
       w[i]=var(D[:,i])
       end
elapsed time: 4.443197509 seconds (14074576 bytes allocated)


julia> @time ww=@parallel (hcat) for i=1:l
       var(D[:,i])
       end
elapsed time: 5.287007403 seconds (435449580 bytes allocated, 5.00% gc time)
1x10000 Array{Float64,2}:

Paul

julia> @time for i=1:l
       w[i]=var(D[:,i])
       end
elapsed time: 4.331569152 seconds (8637464 bytes allocated)

julia> @time ww=@parallel (hcat) for i=1:l
       var(D[:,i])
       end
elapsed time: 4.908234336 seconds (422121448 bytes allocated, 4.85% gc time)
1x10000 Array{Float64,2}:
 0.000703737  0.000731674  0.000582672  0.00080388    0.000759479  
0.000402509  0.0007118  0.000989408

julia> size(D)
(10000,10000)

Reply via email to