Skip to content

Commit

Permalink
Skip aliasing checks in one-argument broadcast!
Browse files Browse the repository at this point in the history
  • Loading branch information
mbauman committed Feb 13, 2018
1 parent 8bda3a9 commit 94262bd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,16 @@ end
return C
end

# In the one-argument case, we don't need to worry about aliasing as we only make one pass
@inline function _broadcast!(f, C, A)
shape = broadcast_indices(C)
@boundscheck check_broadcast_indices(shape, A)
keeps, Idefaults = map_newindexer(shape, A, ())
iter = CartesianIndices(shape)
_broadcast!(f, C, keeps, Idefaults, A, (), Val(0), iter)
return C
end

# broadcast with element type adjusted on-the-fly. This widens the element type of
# B as needed (allocating a new container and copying previously-computed values) to
# accommodate any incompatible new elements.
Expand Down

0 comments on commit 94262bd

Please sign in to comment.