Skip to content
Merged
Changes from all commits
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
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))
Copy link
Member Author

@ranocha ranocha Aug 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is another possibility to fix the invalidations coming from this by specializing on testf since map has also disadvantages, see #46553 (comment). However, always specializing could also have disadvantages in terms of latency, of course. I don't know what's best here 🤷
There are basically four options I see

  • My first suggestion adding a type assertion in mightalias
  • The version with map here, increasing allocations
  • The version with specialization here, possibly increasing compiler workload
  • Just do nothing for now and hope that the compiler will be improved later


"""
findall(A)
Expand Down