Skip to content

Conversation

@ChrisRackauckas-Claude
Copy link

Summary

Similar to #2854, this PR adds type specialization for the f parameter in several functions across OrdinaryDiffEq.jl to improve compatibility with --trim and reduce dynamic dispatch.

Functions specialized

  • jacobian scalar fallback in derivative_wrappers.jl:139
  • sparsity_colorvec in derivative_wrappers.jl:396
  • WOperator constructor in derivative_utils.jl:327
  • islinearfunction in derivative_utils.jl:443
  • _compute_rhs in newton.jl:333
  • DAEResidualJacobianWrapper constructor in utils.jl:74
  • Interpolation functions in generic_dense.jl:
    • _evaluate_interpolant (line 480)
    • evaluate_composite_cache (lines 488, 500)
    • evaluate_default_cache (line 508)
    • evaluate_interpolant (line 531)
  • verify_f2 functions in symplectic_perform_step.jl (lines 80, 85, 91, 95)

Rationale

These functions all either:

  • Call f directly as a function
  • Access fields of f
  • Pass f to other functions
  • Perform type checks on f

Adding where F type parameters enables better compiler optimizations and reduces dynamic dispatch, similar to what was done in PR #2854.

Testing

The package compiles and loads successfully with these changes.

Similar to SciML#2854, this PR adds type specialization for the f parameter in several functions across OrdinaryDiffEq.jl to improve compatibility with --trim and reduce dynamic dispatch.

Functions specialized:
- jacobian scalar fallback in derivative_wrappers.jl
- sparsity_colorvec in derivative_wrappers.jl
- WOperator constructor in derivative_utils.jl
- islinearfunction in derivative_utils.jl
- _compute_rhs in newton.jl
- DAEResidualJacobianWrapper constructor in utils.jl
- Interpolation functions in generic_dense.jl
- verify_f2 functions in symplectic_perform_step.jl

These functions all either call f directly, access fields of f, pass f to other functions, or perform type checks on f, so specialization enables better compiler optimizations.
@ChrisRackauckas ChrisRackauckas merged commit ad277be into SciML:master Aug 21, 2025
152 of 195 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants