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}.

(cherry picked from commit 31d4c22)
  • Loading branch information
ranocha authored and KristofferC committed Sep 16, 2022
1 parent a233e3e commit 237c92d
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 @@ -2308,7 +2308,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 237c92d

Please sign in to comment.