I think replace! is a much better fit for this purpose. It is so fast and has zero allocations.
julia> @btime replace!($a, NaN => 0)
8.980 ns (0 allocations: 0 bytes)
2×3 Array{Float64,2}:
1.0 2.0 3.0
4.0 5.0 0.0
I think replace! is a much better fit for this purpose. It is so fast and has zero allocations.
julia> @btime replace!($a, NaN => 0)
8.980 ns (0 allocations: 0 bytes)
2×3 Array{Float64,2}:
1.0 2.0 3.0
4.0 5.0 0.0