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
mutable struct OnceDifferentiable{F, DF, FDF, TF, TDF, TX} <: AbstractObjective
f::F # objective
df::DF # (partial) derivative of objective
fdf::FDF # objective and (partial) derivative of objective
F::TF # cache for f output
DF::TDF # cache for df output
x_f::TX # x used to evaluate f (stored in F)
x_df::TX # x used to evaluate df (stored in DF)
f_calls::Vector{Int}
df_calls::Vector{Int}
end
Yeah, this is because it's not type stable. This was on purpose to avoid recompilation. I can benchmark it again. The reason is that there's dynamic dispatch which causes allocations.
Based on the discussion at https://discourse.julialang.org/t/surprising-runtime-behaviour-when-wrapping-functions/68140/3 the small test program
prints
Maybe Michael Hatherly's solution improves this test case, too?
The text was updated successfully, but these errors were encountered: