The following example shows that there is a runtime dispatch on accessing an array. Why is that the case, and can I avoid it?
struct example
a::Array{Int64}
end
function examplefun(x::example)
return @inbounds x.a[10]
end
julia> @report_opt examplefun(example([1,2]))
═════ 1 possible error found ═════
│┌ getindex(A::Array{Int64}, i::Int64) @ Base ./essentials.jl:916
││ runtime dispatch detected: Base.throw_boundserror(A::Array{Int64}, %25::Tuple{Int64})
│└────────────────────