Description
As noted in this post (https://stackoverflow.com/questions/47501844/julia-differentialequations-jl-speed/47507933#47507933), DiffEq aggressively specializes on each function. This causes a compilation phase between each new ODE function. However, we can lessen that burden by making less functions (or parts of functions) explicitly depend on the ODE function. Since the integrator is strongly typed with the function, this would mean writing some functions as independent of the integrator. For example, this used to be inline in the init
function:
https://github.com/JuliaDiffEq/OrdinaryDiffEq.jl/blob/master/src/solve.jl#L329-L362
but since it's now refactored out, it's compiled one and shared between all functions. I am not sure how to profile compilation time, but I would believe most of the time is spent in the "inner logic" functions here:
https://github.com/JuliaDiffEq/OrdinaryDiffEq.jl/blob/master/src/integrators/integrator_utils.jl
All of these functions are functions of integrator
which is why they specialize each time, but many of them are not dependent on f
so it may be possible to make this not specialize on f
.