Skip to content

Commit

Permalink
Improve dispatch of findall(testf::F, A::AbstractArray) (#46553)
Browse files Browse the repository at this point in the history
This prevents some invalidations in `mightalias(A::AbstractArray, B::AbstractArray)`
in abstractarray.jl when loading Static.jl.

Here we specialize on the function instead of using map since
`broadcasting` returns a BitArray, `map` returns a Vector{Bool}.
  • Loading branch information
ranocha committed Sep 6, 2022
1 parent 305e2fb commit 31d4c22
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,7 @@ findall(testf::Function, A) = collect(first(p) for p in pairs(A) if testf(last(p

# Broadcasting is much faster for small testf, and computing
# integer indices from logical index using findall has a negligible cost
findall(testf::Function, A::AbstractArray) = findall(testf.(A))
findall(testf::F, A::AbstractArray) where {F<:Function} = findall(testf.(A))

"""
findall(A)
Expand Down

0 comments on commit 31d4c22

Please sign in to comment.