You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here, the vararg splatting in enter!(t::Trace, args...) accounts for a large fraction of the above allocations and runtime. Switching to args::Vararg{Any, N} where N doesn't seem to help:
julia>functionenter!(t::Trace, args::Vararg{Any, N}) where {N}
pair = args => Any[]
push!(t.current, pair)
push!(t.stack, t.current)
t.current = pair.second
returnnothingend
enter! (generic function with 1 method)
julia>@btime Cassette.overdub(TraceCtx(metadata = trace), () ->f(x, y, z))
3.883 μs (61 allocations:1.81 KiB)
0.1532882013156685
(note that enter!(t::Trace, args::Vararg{<:T, N}) where {T, N} won't work because it forces all the varargs to be the same subtype of T.)
In
Cassette.overdub
passes, one often finds that varargs incurs a performance penalty.For instance,
Here, the vararg splatting in
enter!(t::Trace, args...)
accounts for a large fraction of the above allocations and runtime. Switching toargs::Vararg{Any, N} where N
doesn't seem to help:(note that
enter!(t::Trace, args::Vararg{<:T, N}) where {T, N}
won't work because it forces all the varargs to be the same subtype ofT
.)but a macro I made for getting around this does:
What the above macro did was to make 5 copies of the method:
This is a bit clunky and ideally wouldn't be necessary if
args::Vararg{Any, N}
or something similar was more strict.The text was updated successfully, but these errors were encountered: