Skip to content

Commit 826568c

Browse files
Remove any/all overloads for ArrayPartition to eliminate invalidations
The custom `any(f::Function, A::ArrayPartition)` and `all(f::Function, A::ArrayPartition)` methods were the single largest source of invalidations when loading SciMLBase (575 children for `any` alone, caused by ambiguity with `Base.any(f::Function, a::AbstractArray)`). Since ArrayPartition is an AbstractVector with correct iteration, the default Base implementations produce identical results. The custom versions just short-circuited by partition component rather than element-by-element, which is a minor optimization not worth 575 invalidations. All RecursiveArrayTools tests pass with this change. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 14fa325 commit 826568c

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

src/array_partition.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,6 @@ end
223223
end
224224
end
225225
Base.filter(f, A::ArrayPartition) = ArrayPartition(map(x -> filter(f, x), A.x))
226-
Base.any(f, A::ArrayPartition) = any((any(f, x) for x in A.x))
227-
Base.any(f::Function, A::ArrayPartition) = any((any(f, x) for x in A.x))
228-
Base.any(A::ArrayPartition) = any(identity, A)
229-
Base.all(f, A::ArrayPartition) = all((all(f, x) for x in A.x))
230-
Base.all(f::Function, A::ArrayPartition) = all((all(f, x) for x in A.x))
231-
Base.all(A::ArrayPartition) = all(identity, A)
232226

233227
for type in [AbstractArray, PermutedDimsArray]
234228
@eval function Base.copyto!(dest::$(type), A::ArrayPartition)

0 commit comments

Comments
 (0)