SciML/OrdinaryDiffEq.jl

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

開放

#229 建立於 2017年11月27日

 (5 則留言) (0 個反應) (0 位負責人)Julia (262 個分叉)batch import
Hacktoberfesteasyhelp wantedlow-priority

倉庫指標

星標
 (656 顆星)
PR 合併指標
 (平均合併 3天 12小時) (30 天內合併 74 個 PR)

描述

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.

貢獻者指南