SciML/OrdinaryDiffEq.jl

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

オープン

#229 opened on 2017/11/27

 (5 件のコメント) (0 件のリアクション) (0 人の担当者)Julia (262 件のフォーク)batch import
Hacktoberfesteasyhelp wantedlow-priority

Repository metrics

Stars
 (656 個のスター)
PR merge metrics
 (平均マージ 3d 12h) (30d で 74 merged PRs)

説明

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.

コントリビューターガイド