From f2d2d6f465da338062fee79bddf18a9cf56652fd Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Wed, 9 Jan 2019 13:30:02 +0100 Subject: [PATCH] Force specialization of the SubArray boundserror method. Improves https://github.com/JuliaLang/julia/pull/29867 by avoiding an invoke. --- base/subarray.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/subarray.jl b/base/subarray.jl index 2d6f8a709a642..3c3bb89d271f2 100644 --- a/base/subarray.jl +++ b/base/subarray.jl @@ -42,7 +42,7 @@ check_parent_index_match(parent, ::NTuple{N, Bool}) where {N} = # are inlined @inline Base.throw_boundserror(A::SubArray, I) = __subarray_throw_boundserror(typeof(A), A.parent, A.indices, A.offset1, A.stride1, I) -@noinline __subarray_throw_boundserror(T, parent, indices, offset1, stride1, I) = +@noinline __subarray_throw_boundserror(::Type{T}, parent, indices, offset1, stride1, I) where {T} = throw(BoundsError(T(parent, indices, offset1, stride1), I)) # This computes the linear indexing compatibility for a given tuple of indices