Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadcast shouldn't use inbounds when calling f #19188

Merged
merged 2 commits into from
Nov 4, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add inbounds elsewhere in broadcast
Try to restore some performance by allowing inbounds propagation into _broadcast_getindex.
mbauman committed Nov 3, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 3ed5814a1f46c931db33289b9d7afa39f0c62e25
6 changes: 3 additions & 3 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
@@ -120,9 +120,9 @@ map_newindexer(shape, ::Tuple{}) = (), ()
(keep, keeps...), (Idefault, Idefaults...)
end

@inline _broadcast_getindex(A, I) = _broadcast_getindex(containertype(A), A, I)
@inline _broadcast_getindex(::Type{Any}, A, I) = A
@inline _broadcast_getindex(::Any, A, I) = A[I]
Base.@propagate_inbounds _broadcast_getindex(A, I) = _broadcast_getindex(containertype(A), A, I)
Base.@propagate_inbounds _broadcast_getindex(::Type{Any}, A, I) = A
Base.@propagate_inbounds _broadcast_getindex(::Any, A, I) = A[I]

## Broadcasting core
# nargs encodes the number of As arguments (which matches the number