No allocs after restart

I think this is just showing it’s a generated function. Can’t really guess where the 10M allocations are from (over how many iterations?) without details. I do recall that it’s the reinit_wrapper call that gets flagged as a runtime dispatch by JET.jl, but that is only supposed to be run automatically at precompile-time, not at runtime.

Even less certain about this causing allocations, but worth saying that reinit_wrapper mutation is necessary to make even newly instantiated FunctionWrappers respond to dynamic method changes. This isn’t documented or public but I spot no alternative in the source.

julia> using FunctionWrappers: FunctionWrappers as FWs, FunctionWrapper as FW

julia> foo() = 1; fwoo = FW{Int, Tuple{}}(foo);

julia> foo(), fwoo() # works as expected
(1, 1)

julia> foo() = 2; foo(), fwoo() # previous wrapper is obsolete
(2, 1)

julia> fwoo2 = FW{Int, Tuple{}}(foo); foo(), fwoo(), fwoo2() # new wrapper is obsolete
(2, 1, 1)

julia> FWs.reinit_wrapper(fwoo); foo(), fwoo(), fwoo2() # reinit_wrapper updates a wrapper
(2, 2, 1)

julia> foo() = 3; fwoo3 = FW{Int, Tuple{}}(foo); foo(), fwoo(), fwoo2(), fwoo3() # new wrapper is obsolete to 1st version
(3, 2, 1, 1)