mentat-collective / emmy

The Emmy Computer Algebra System.
https://emmy.mentat.org
GNU General Public License v3.0
391 stars 22 forks source link

Speed up compiled state derivatives #7

Closed sritchie closed 1 year ago

sritchie commented 1 year ago

The animation work from the various Clerk related projects has made it clear that the ODE solver can be way faster. The main thing that is is slow is the conversion to and from a nested structure on every call of the derivative function. Instead, we can compile a function that takes a native input and output array of doubles, reads from the input with aget and then mutates the output, returning nothing.

If you want the old behavior, fine, we can pass a flag, or beef up the other compilation step to support it.

For the double pendulum example this gives me at least a 20x speedup.

sritchie commented 1 year ago

So close on this, @littleredcomputer !

sritchie commented 1 year ago

I'm going to call this closed, @littleredcomputer .