File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,14 @@ version = "1.3.0"
66DiffEqBase = " 2b5f629d-d688-5b77-993f-72d75c75574e"
77MATLAB = " 10e44e05-a98a-55b3-a45b-ba969058deb6"
88ModelingToolkit = " 961ee093-0014-501f-94e3-6117800e7a78"
9+ PrecompileTools = " aea7be01-6a6a-4083-8856-8a6e6704d82a"
910Reexport = " 189a3867-3050-52da-a836-e630ba90ab69"
1011
1112[compat ]
1213DiffEqBase = " 6.122"
1314MATLAB = " 0.8, 0.9"
1415ModelingToolkit = " 8, 9, 10, 11"
16+ PrecompileTools = " 1"
1517Reexport = " 0.2, 1.0"
1618julia = " 1.6"
1719
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ module MATLABDiffEq
33using Reexport
44@reexport using DiffEqBase
55using MATLAB, ModelingToolkit
6+ using PrecompileTools
67
78# Handle ModelingToolkit API changes: states -> unknowns
89if isdefined(ModelingToolkit, :unknowns)
@@ -152,4 +153,33 @@ function buildDEStats(solverstats::Dict)
152153 destats
153154end
154155
156+ @setup_workload begin
157+ # Precompile algorithm struct instantiations and buildDEStats
158+ @compile_workload begin
159+ # Instantiate algorithm structs - this precompiles their constructors
160+ _ = ode23()
161+ _ = ode45()
162+ _ = ode113()
163+ _ = ode23s()
164+ _ = ode23t()
165+ _ = ode23tb()
166+ _ = ode15s()
167+ _ = ode15i()
168+
169+ # Precompile buildDEStats with typical MATLAB stats dictionaries
170+ test_stats = Dict{String, Any}(
171+ " nfevals" => 100 ,
172+ " nfailed" => 5 ,
173+ " nsteps" => 95 ,
174+ " nsolves" => 50 ,
175+ " npds" => 10 ,
176+ " ndecomps" => 8
177+ )
178+ _ = buildDEStats(test_stats)
179+
180+ # Also precompile with missing keys (common case)
181+ _ = buildDEStats(Dict{String, Any}())
182+ end
183+ end
184+
155185end # module
You can’t perform that action at this time.
0 commit comments