@breandan stealing some of yours back, would you look at this: https://github.com/altavir/kmath/blob/037735c210e437a4ecf02fbbe24fb37132c6ef8a/kmath-commons/src/test/kotlin/scientifik/kmath/expressions/AutoDiffTest.kt#L21
I use commons-maths auto-differentiation package. It has its limitations, for example argument names must be known ahead of time, but performance should be significantly better than in pure functional implementation. In fact, after some tweaks, it will probably possible to use it inside complicated expressions like numerical integrals. It is also possible to use the same approach in differential algebra.
I do not plan to invest additional effort into this in near future unless you are or someone else have a request and wants to join efforts.