I understand that in Julia most operators can be vectorized by prefixing it with .. However I don't understand why some of them worth both ways:
julia> a = rand(1_000_000);
julia> @time a*2;
0.051112 seconds (183.93 k allocations: 17.849 MiB, 7.14% gc time, 89.16% compilation time)
julia> @time a*2;
0.002070 seconds (2 allocations: 7.629 MiB)
julia> @time a.*2;
0.026533 seconds (8.87 k allocations: 8.127 MiB, 93.23% compilation time)
julia> @time a.*2;
0.001575 seconds (4 allocations: 7.630 MiB)
julia> a + 0.1;
ERROR: MethodError: no method matching +(::Vector{Float64}, ::Float64)
Why array broadcasting works for * but not +?
What drives the difference in performance/allocations between * and .*?