# Benchmarks

The following tables present the running times of differentiation operations for a set of benchmark cases. For descriptions of the differentiation operations, please refer to API Overview.

The values are normalized with respect to the running time of the original function corresponding to each column. Operations diffn and diffn' are used with $$n=2$$, for enabling comparisons with diff2 and diff2'.

The benchmark functions are:

$f_{ss}(x) = l_{100}\; ,$

where $$l_{n + 1} = 4 l_{n} (1 - l_n)$$ and $$l_1 = x$$ (the logistic map), for the scalar-to-scalar case;

$f_{vs}(\mathbf{x}) = \mathbf{x}^{\textrm{T}} \left(\log \frac{\textbf{x}}{2}\right)\; ,$

where $$\log$$ and division by scalar is applied element-wise to vector $$\mathbf{x}$$, for the vector-to-scalar case; and

$f_{vv}(\mathbf{x}) = \left( \mathbf{x}^{\textrm{T}}\left(\log \frac{\textbf{x}}{2}\right),\, \textrm{sum}\{\exp\left(\sin\textbf{x}\right)\},\, \textrm{sum}\{\exp\left(\cos\textbf{x}\right)\}\right)\;$

for the vector-to-vector case.

The running times are averaged over 10000 calls to each operation, with vector size 100, on a PC with an Intel Core i7-4785T 2.2 GHz CPU and 16 GB RAM, running Windows 10 Build 10240 and .NET Framework 4.6.

Please note that the numbers for multivariate functions are highly dependent on the selected size of the input vector (i.e., independent variables). The Helmholtz Energy Function page demonstrates how the overhead factors scale as a function of the number of independent variables.

diff diff2 diffn grad gradv hessian hessianv gradhessian gradhessianv laplacian jacobian jacobianv jacobianT jacobianTv
AD 3.33 9.30 9.21 4.79 2.11 810.22 9.62 823.86 9.55 814.19 15.10 2.55 15.41 4.53
Numerical 1.93 2.78 161.36 3.49 16.75k 322.88 16.82k 326.97 16.75k 112.54 2.21 111.38
diff' diff2' diffn' grad' gradv' hessian' hessianv' gradhessian' gradhessianv' laplacian' jacobian' jacobianv' jacobianT' jacobianTv'
AD 3.35 12.30 10.12 4.70 2.05 821.31 9.56 808.22 9.66 810.23 15.05 2.51 15.26 4.50
Numerical 2.82 3.71 160.56 4.66 16.78k 323.03 16.80k 327.68 16.78k 111.62 3.20 112.43

The benchmarks given in the above table can be replicated using the benchmarking tool:

dsbench -vsize 100 -r 10000

## Running Benchmarks on Your Machine

If you would like to run the benchmarks on your own machine, you can use the dsbench command line tool distributed together with the latest release on GitHub.