I’m trying to compute Jacobian and function values simultaneously using ForwardDiff.jl. A simple MWE example is

```
using StaticArrays
using ForwardDiff
using DiffResults
using BenchmarkTools
f(x) = SVector((@. x[1]*x[2]), x[1]+x[2])
df(x) = ForwardDiff.jacobian(f,x)
df_diffres(x) = ForwardDiff.jacobian!(DiffResults.JacobianResult(x),f,x)
```

If I benchmark each routine, the evaluation of `f`

and `df`

are both similar cost. However, evaluating `df_diffres`

takes significantly longer than evaluating both the function and Jacobian.

```
julia> x = SVector(1,2);
julia> @btime f($x)
0.039 ns (0 allocations: 0 bytes)
julia> @btime df($x)
0.039 ns (0 allocations: 0 bytes)
julia> @btime df_diffres($x)
1.214 μs (14 allocations: 608 bytes)
```

Am I using DiffResults.jl incorrectly, or is there a way to reduce runtimes and allocations?