SciML/OrdinaryDiffEq.jl

Refactor some core functionality into smaller functions for more compilation cache reuse

Aperta

#229 aperta il 27 nov 2017

 (5 commenti) (0 reazioni) (0 assegnatari)Julia (262 fork)batch import
Hacktoberfesteasyhelp wantedlow-priority

Metriche repository

Star
 (656 stelle)
Metriche merge PR
 (Merge medio 3g 12h) (74 PR mergiate in 30 g)

Descrizione

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.

Guida contributor