I recommend reading Performance Tips · The Julia Language
function f(d,rands)
for (i, r) in enumerate(rands)
d[i] = r
end
end
rands = rand(10^7)
@time f(Dict{Int, Float64}(), rands);
0.857354 seconds (72 allocations: 541.170 MiB, 1.51% gc time)