Optimal way of using simple map()
is by avoiding to use lambda function. So for example
dbl(x)=x*2
arr=rand(1000)
non-optimal method is significantly more expensive.
julia> @time map(dbl, arr);
0.000090 seconds (7 allocations: 8.125 KB)
and by avoiding the use of lambda you get
julia> @time map(x->dbl(x), arr);
0.040455 seconds (13.77 k allocations: 632.087 KB)
Streams by this user that have been favorited by others.
No favorited streams yet.
Optimal way of using simple map()
is by avoiding to use lambda function. So for example
dbl(x)=x*2
arr=rand(1000)
non-optimal method is significantly more expensive.
julia> @time map(dbl, arr);
0.000090 seconds (7 allocations: 8.125 KB)
and by avoiding the use of lambda you get
julia> @time map(x->dbl(x), arr);
0.040455 seconds (13.77 k allocations: 632.087 KB)
Thoughts by this user that have been liked by others.
Optimal way of using simple map()
is by avoiding to use lambda function. So for example
dbl(x)=x*2
arr=rand(1000)
non-optimal method is significantly more expensive.
julia> @time map(dbl, arr);
0.000090 seconds (7 allocations: 8.125 KB)
and by avoiding the use of lambda you get
julia> @time map(x->dbl(x), arr);
0.040455 seconds (13.77 k allocations: 632.087 KB)