Commit 10f591e
committed
Remove redundant any/all methods on ArrayPartition to reduce invalidations
The custom `any(f::Function, A::ArrayPartition)` and `all(f::Function, ...)`
methods caused 585 method invalidations when loading OrdinaryDiffEq, including
invalidating critical Compiler internals (531 children from
`any(::Compiler.compileable_specialization_check, ::AbstractArray)`).
The `f::Function` specializations were redundant since the generic `f` versions
already existed, but they conflicted with Base's `any(f::Function, a::AbstractArray; dims)`.
The generic `f` versions also caused invalidations for the same reason — any
new method on `any` for an `AbstractArray` subtype will invalidate cached
`any(f, ::AbstractArray)` specializations.
Since `ArrayPartition` implements proper iteration (via `eachindex` and `getindex`),
the default `AbstractArray` implementations of `any` and `all` work correctly.
Removing the custom methods eliminates the invalidation source with no behavioral change.
Verified: `any(x->x>4, A)`, `all(x->x>0, A)`, `any(iszero, A)`, `any(A)` etc.
all produce correct results via the default AbstractArray path.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>1 parent 6cdda9c commit 10f591e
1 file changed
Lines changed: 0 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | 226 | | |
233 | 227 | | |
234 | 228 | | |
| |||
0 commit comments