Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion test/finitedifftests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,11 @@ central_cache = FiniteDiff.GradientCache(df, x, Val{:central})
@test err_func(FiniteDiff.finite_difference_gradient!(df, f, x, central_cache), df_ref) < 3e-7
end

function ret_allocs(res, _f, x, cache)
# Force specialization on the function argument. Without `::F where {F}`, Julia
# does not specialize this helper on `_f` (a bare Function it only forwards), so
# the inner call dispatches dynamically and the wrapper itself allocates ~48
# bytes on 1.10/1.11 (0 on 1.12+) — a measurement artifact, not library work.
function ret_allocs(res, _f::F, x, cache) where {F}
allocs = @allocated FiniteDiff.finite_difference_gradient!(res, _f, x, cache)
allocs
end
Expand Down
Loading