Skip to content

Commit

Permalink
faster copyto
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed Dec 22, 2021
1 parent fa8be6f commit 8ad4716
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -904,9 +904,18 @@ end

function copyto!(dest::AbstractArray, dstart::Integer, src)
i = Int(dstart)
for x in src
dest[i] = x
i += 1
if haslength(src)
checkbounds(dest, i)
checkbounds(dest, i + length(src) - 1)
for x in src
@inbounds dest[i] = x
i += 1
end
else
for x in src
dest[i] = x
i += 1
end
end
return dest
end
Expand Down

0 comments on commit 8ad4716

Please sign in to comment.