It seems like this is a inference bug of some kind. If I pass a function instead of the Float64
constructor, I get no allocations:
julia> s1(x) = sum(y -> Float64(y), x)
s1 (generic function with 1 method)
julia> @btime s1($x);
41.182 μs (0 allocations: 0 bytes)
Filed as julia#36783.