Closed ghost closed 4 years ago
So this one I will close based on pure stylistic preference - I somehow always read fill as though it would be filling s.no_comps here, so find the array comprehension slightly clearer. Performance seems to be the same:
fill
s.no_comps
julia> using BenchmarkTools julia> @btime fill(1e-5, 10); 44.386 ns (1 allocation: 160 bytes) julia> @btime fill(1e-5, 100); 108.841 ns (1 allocation: 896 bytes) julia> @btime fill(1e-5, 1000); 968.800 ns (1 allocation: 7.94 KiB) julia> @btime [1e-5 for _ ∈ 1:10]; 46.384 ns (1 allocation: 160 bytes) julia> @btime [1e-5 for _ ∈ 1:100]; 112.104 ns (1 allocation: 896 bytes) julia> @btime [1e-5 for _ ∈ 1:1000]; 984.000 ns (1 allocation: 7.94 KiB)
So this one I will close based on pure stylistic preference - I somehow always read
fill
as though it would be fillings.no_comps
here, so find the array comprehension slightly clearer. Performance seems to be the same: