I am on 1.7:
julia> versioninfo()
Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin19.5.0)
CPU: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
julia> @benchmark U(1, 5, 2, 2, 1; data=$data, θ=$θ)
BenchmarkTools.Trial: 10000 samples with 996 evaluations.
Range (min … max): 23.635 ns … 680.684 ns ┊ GC (min … max): 0.00% … 96.10%
Time (median): 25.550 ns ┊ GC (median): 0.00%
Time (mean ± σ): 27.063 ns ± 12.358 ns ┊ GC (mean ± σ): 0.69% ± 1.66%
█▇▆▄▂ ▁
▇███████▇▆▅▅▅▄▂▃▄▃▃▃▂▃▂▂▄▃██▇▅▃▇▇▆▆█▇▆▇▆▆▄▃▄▄▃▂▃▄▄▃▄▃▃▄▃▂▃▅▆ █
23.6 ns Histogram: log(frequency) by time 58.7 ns <
Memory estimate: 16 bytes, allocs estimate: 1.
Here is @code_warntype
julia> @code_warntype U(1, 5, 2, 2, 1; data=data, θ=θ)
MethodInstance for (::var"#U##kw")(::NamedTuple{(:data, :θ), Tuple{ComponentVector{Float64, Vector{Float64}, Tuple{Axis{(w = ViewAxis(1:3600, ShapedAxis((2, 9, 2, 2, 5, 10), NamedTuple())), P_1 = ViewAxis(3601:3650, ShapedAxis((5, 10), NamedTuple())), eb = ViewAxis(3651:3700, ShapedAxis((5, 10), NamedTuple())))}}}, ComponentVector{Float64, Vector{Float64}, Tuple{Axis{(α0 = ViewAxis(1:20, ShapedAxis((2, 2, 5), NamedTuple())), α = 21:23)}}}}}, ::typeof(U), ::Int64, ::Int64, ::Int64, ::Int64, ::Int64)
from (::var"#U##kw")(::Any, ::typeof(U), g, a, e, k, t) in Main at REPL[11]:1
Arguments
_::Core.Const(var"#U##kw"())
@_2::NamedTuple{(:data, :θ), Tuple{ComponentVector{Float64, Vector{Float64}, Tuple{Axis{(w = ViewAxis(1:3600, ShapedAxis((2, 9, 2, 2, 5, 10), NamedTuple())), P_1 = ViewAxis(3601:3650, ShapedAxis((5, 10), NamedTuple())), eb = ViewAxis(3651:3700, ShapedAxis((5, 10), NamedTuple())))}}}, ComponentVector{Float64, Vector{Float64}, Tuple{Axis{(α0 = ViewAxis(1:20, ShapedAxis((2, 2, 5), NamedTuple())), α = 21:23)}}}}}
@_3::Core.Const(U)
g::Int64
a::Int64
e::Int64
k::Int64
t::Int64
Locals
data::ComponentVector{Float64, Vector{Float64}, Tuple{Axis{(w = ViewAxis(1:3600, ShapedAxis((2, 9, 2, 2, 5, 10), NamedTuple())), P_1 = ViewAxis(3601:3650, ShapedAxis((5, 10), NamedTuple())), eb = ViewAxis(3651:3700, ShapedAxis((5, 10), NamedTuple())))}}}
θ::ComponentVector{Float64, Vector{Float64}, Tuple{Axis{(α0 = ViewAxis(1:20, ShapedAxis((2, 2, 5), NamedTuple())), α = 21:23)}}}
@_11::ComponentVector{Float64, Vector{Float64}, Tuple{Axis{(w = ViewAxis(1:3600, ShapedAxis((2, 9, 2, 2, 5, 10), NamedTuple())), P_1 = ViewAxis(3601:3650, ShapedAxis((5, 10), NamedTuple())), eb = ViewAxis(3651:3700, ShapedAxis((5, 10), NamedTuple())))}}}
@_12::ComponentVector{Float64, Vector{Float64}, Tuple{Axis{(α0 = ViewAxis(1:20, ShapedAxis((2, 2, 5), NamedTuple())), α = 21:23)}}}
Body::Float64
1 ─ %1 = Base.haskey(@_2, :data)::Core.Const(true)
│ Core.typeassert(%1, Core.Bool)
│ (@_11 = Base.getindex(@_2, :data))
└── goto #3
2 ─ Core.Const(:(@_11 = Main.data))
3 ┄ %6 = @_11::ComponentVector{Float64, Vector{Float64}, Tuple{Axis{(w = ViewAxis(1:3600, ShapedAxis((2, 9, 2, 2, 5, 10), NamedTuple())), P_1 = ViewAxis(3601:3650, ShapedAxis((5, 10), NamedTuple())), eb = ViewAxis(3651:3700, ShapedAxis((5, 10), NamedTuple())))}}}
│ (data = %6)
│ %8 = Base.haskey(@_2, :θ)::Core.Const(true)
│ Core.typeassert(%8, Core.Bool)
│ (@_12 = Base.getindex(@_2, :θ))
└── goto #5
4 ─ Core.Const(:(@_12 = Main.θ))
5 ┄ %13 = @_12::ComponentVector{Float64, Vector{Float64}, Tuple{Axis{(α0 = ViewAxis(1:20, ShapedAxis((2, 2, 5), NamedTuple())), α = 21:23)}}}
│ (θ = %13)
│ %15 = (:data, :θ)::Core.Const((:data, :θ))
│ %16 = Core.apply_type(Core.NamedTuple, %15)::Core.Const(NamedTuple{(:data, :θ)})
│ %17 = Base.structdiff(@_2, %16)::Core.Const(NamedTuple())
│ %18 = Base.pairs(%17)::Core.Const(Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}())
│ %19 = Base.isempty(%18)::Core.Const(true)
│ Core.typeassert(%19, Core.Bool)
└── goto #7
6 ─ Core.Const(:(Base.kwerr(@_2, @_3, g, a, e, k, t)))
7 ┄ %23 = Main.:(var"#U#1")(data, θ, @_3, g, a, e, k, t)::Float64
└── return %23