I just wanted to mention some performance regression that’s taken place
since 2.4.0, mostly due to all of the NaN checking that was added.
First-order gradients have gradually slowed by about 5% from a variety
of contributions (the new memory pattern, nested autodiff, NaN checking,
etc). Each commit yields a pretty marginal change in performance and
only the aggregate performance manifests in a noticeable slowdown,
at least as far as I can tell.
Higher-order derivatives took a huge hit from the introduction of fvar
NaN checks in
https://github.com/stan-dev/stan/commit/2c4cc3ee5b78fa7cee563a1d9faf569b17c8f447,
slowing down by over 67%. There is no immediate solution to this
slow down without removing the NaN checks — in Nomad I avoided
this by having the checks templated and readily turned off by the user
when speed is a concern.