Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrisRackauckas/303768d93391f4f007288961450f2df3 to your computer and use it in GitHub Desktop.
Save ChrisRackauckas/303768d93391f4f007288961450f2df3 to your computer and use it in GitHub Desktop.
Conservative package compiler testing

Conservative Package Compiler Results

  1. Using a ton of standard pervasive packages only helps 10%
  2. Getting DiffEqBase helps 50%
  3. Getting OrdinaryDiffEq without extra precompiles gets to 1.3 seconds, vs 0.6 seconds on the second run. That's pretty good!
using PackageCompiler
conservative = [
:MacroTools
:MuladdMacro
:TimerOutputs
:ForwardDiff
:Plots
:Lazy
:StaticArrays
:BenchmarkTools
:Latexify
:Debugger
:Unitful
:IterativeSolvers
:Parameters
:Reexport
:NLsolve
:SpecialFunctions
:FiniteDiff
:SimpleTraits
:RecipesBase
:LabelledArrays
:AbstractFFTs
:UnPack
]
diffeqbase = [
:DiffEqBase
]
ordinarydiffeq = [
:OrdinaryDiffEq
]
PackageCompiler.create_sysimage(vcat(conservative,diffeqbase);
replace_default=true)
@time begin
using OrdinaryDiffEq
f(u,p,t) = 1.01*u
u0=1/2
tspan = (0.0,1.0)
prob = ODEProblem(f,u0,tspan)
sol = solve(prob,Tsit5(),reltol=1e-8,abstol=1e-8)
end
# Before
10.289882 seconds (23.34 M allocations: 1.292 GiB, 4.54% gc time)
# After Conservative
9.634908 seconds (18.76 M allocations: 1.034 GiB, 4.11% gc time)
# After DiffEqBase
5.029686 seconds (8.19 M allocations: 439.332 MiB, 5.37% gc time)
# After OrdinaryDiffEq
1.310768 seconds (3.26 M allocations: 174.868 MiB, 10.44% gc time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment