Skip to content

Commit

Permalink
make copymutable(::Array) use copy to avoid overhead
Browse files Browse the repository at this point in the history
  • Loading branch information
thchr committed Oct 18, 2024
1 parent f1990e2 commit ee3face
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@ function copymutable(a::AbstractArray)
copyto!(similar(a), a)
end
copymutable(itr) = collect(itr)
copymutable(a::Array) = copy(a)

zero(x::AbstractArray{T}) where {T<:Number} = fill!(similar(x, typeof(zero(T))), zero(T))
zero(x::AbstractArray{S}) where {S<:Union{Missing, Number}} = fill!(similar(x, typeof(zero(S))), zero(S))
Expand Down

0 comments on commit ee3face

Please sign in to comment.