From fbb047cc43c105cfa8e320a3c06e236d603eaee9 Mon Sep 17 00:00:00 2001 From: Matt Bauman Date: Sun, 22 Jan 2017 22:48:08 -0600 Subject: [PATCH] Ensure linearindices completely inlines (through _length) --- base/abstractarray.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/base/abstractarray.jl b/base/abstractarray.jl index db682c9e07ee9..fbdf2f51133a0 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -120,10 +120,10 @@ julia> length(A) 60 ``` """ -length(t::AbstractArray) = prod(size(t)) -_length(A::AbstractArray) = prod(map(unsafe_length, indices(A))) # circumvent missing size -_length(A) = length(A) -endof(a::AbstractArray) = length(a) +length(t::AbstractArray) = (@_inline_meta; prod(size(t))) +_length(A::AbstractArray) = (@_inline_meta; prod(map(unsafe_length, indices(A)))) # circumvent missing size +_length(A) = (@_inline_meta; length(A)) +endof(a::AbstractArray) = (@_inline_meta; length(a)) first(a::AbstractArray) = a[first(eachindex(a))] """