Skip to content

Commit c600717

Browse files
committed
nospecialize a few more things that gain many specializations without having significant runtime
1 parent 963fb0b commit c600717

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

lib/ModelingToolkitBase/src/problems/linearproblem.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,17 @@ function SciMLBase.LinearProblem{iip}(
117117
end
118118

119119
function get_A_b_from_LinearFunction(
120-
sys::System, f::LinearFunction, op; kws...
120+
sys::System, @nospecialize(f::LinearFunction), op; kws...
121121
)
122122
return get_A_b_from_LinearFunction(sys, f, Symbolics.FixpointSubstituter{true}(op); kws...)
123123
end
124124

125125
function get_A_b_from_LinearFunction(
126-
sys::System, f::LinearFunction, subber::Symbolics.FixpointSubstituter{true}; eval_expression = false,
127-
eval_module = @__MODULE__, expression = Val{false}, u0_constructor = identity,
128-
u0_eltype = float
126+
sys::System, @nospecialize(f::LinearFunction), subber::Symbolics.FixpointSubstituter{true};
127+
eval_expression = false, eval_module = @__MODULE__,
128+
@nospecialize(expression = Val{false}),
129+
@nospecialize(u0_constructor = identity),
130+
@nospecialize(u0_eltype = float)
129131
)
130132
@unpack A, b, interface = f
131133
if A isa Matrix{SymbolicT}

lib/ModelingToolkitBase/src/systems/codegen.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,8 +1216,8 @@ The signatures will be of the form `g(...)` with arguments:
12161216
For example, a function `g(op, unknowns, p..., inputs, t, known_disturbances)` will be the in-place function generated if `return_inplace` is true, `ts` is a vector,
12171217
an array of inputs `inputs` is given, `known_disturbance_inputs` is provided, and `param_only` is false for a time-dependent system.
12181218
"""
1219-
function build_explicit_observed_function(
1220-
sys, ts;
1219+
Base.@nospecializeinfer function build_explicit_observed_function(
1220+
sys, @nospecialize(ts);
12211221
inputs = nothing,
12221222
disturbance_inputs = nothing,
12231223
known_disturbance_inputs = nothing,

lib/ModelingToolkitBase/src/systems/problem_utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,8 +1508,8 @@ $PROBLEM_INTERNAL_KWARGS
15081508
15091509
All other keyword arguments are passed as-is to `constructor`.
15101510
"""
1511-
function process_SciMLProblem(
1512-
constructor, sys::AbstractSystem, op;
1511+
Base.@nospecializeinfer function process_SciMLProblem(
1512+
@nospecialize(constructor), sys::AbstractSystem, @nospecialize(op);
15131513
build_initializeprob = supports_initialization(sys),
15141514
implicit_dae = false, t = nothing, guesses = AnyDict(),
15151515
warn_initialize_determined = true, initialization_eqs = [],

0 commit comments

Comments
 (0)