Skip to content

Commit e1c9a4b

Browse files
mbaumantkelman
authored andcommitted
Ensure linearindices completely inlines (through _length)
(cherry picked from commit fbb047c) originally from #20079
1 parent 98479af commit e1c9a4b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

base/abstractarray.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ julia> length(A)
122122
60
123123
```
124124
"""
125-
length(t::AbstractArray) = prod(size(t))
126-
_length(A::AbstractArray) = prod(map(unsafe_length, indices(A))) # circumvent missing size
127-
_length(A) = length(A)
128-
endof(a::AbstractArray) = last(linearindices(a))
125+
length(t::AbstractArray) = (@_inline_meta; prod(size(t)))
126+
_length(A::AbstractArray) = (@_inline_meta; prod(map(unsafe_length, indices(A)))) # circumvent missing size
127+
_length(A) = (@_inline_meta; length(A))
128+
endof(a::AbstractArray) = (@_inline_meta; last(linearindices(a)))
129129
first(a::AbstractArray) = a[first(eachindex(a))]
130130

131131
function first(itr)

0 commit comments

Comments
 (0)