Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ version = "1.3.0"
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
MATLAB = "10e44e05-a98a-55b3-a45b-ba969058deb6"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"

[compat]
DiffEqBase = "6.122"
MATLAB = "0.8, 0.9"
ModelingToolkit = "8, 9, 10, 11"
PrecompileTools = "1"
Reexport = "0.2, 1.0"
julia = "1.6"

Expand Down
30 changes: 30 additions & 0 deletions src/MATLABDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module MATLABDiffEq
using Reexport
@reexport using DiffEqBase
using MATLAB, ModelingToolkit
using PrecompileTools

# Handle ModelingToolkit API changes: states -> unknowns
if isdefined(ModelingToolkit, :unknowns)
Expand Down Expand Up @@ -152,4 +153,33 @@ function buildDEStats(solverstats::Dict)
destats
end

@setup_workload begin
# Precompile algorithm struct instantiations and buildDEStats
@compile_workload begin
# Instantiate algorithm structs - this precompiles their constructors
_ = ode23()
_ = ode45()
_ = ode113()
_ = ode23s()
_ = ode23t()
_ = ode23tb()
_ = ode15s()
_ = ode15i()

# Precompile buildDEStats with typical MATLAB stats dictionaries
test_stats = Dict{String, Any}(
"nfevals" => 100,
"nfailed" => 5,
"nsteps" => 95,
"nsolves" => 50,
"npds" => 10,
"ndecomps" => 8
)
_ = buildDEStats(test_stats)

# Also precompile with missing keys (common case)
_ = buildDEStats(Dict{String, Any}())
end
end

end # module
Loading