Skip to content

refactor: several TTFX improvements#4582

Merged
AayushSabharwal merged 9 commits into
masterfrom
as/ttfx
Jun 22, 2026
Merged

refactor: several TTFX improvements#4582
AayushSabharwal merged 9 commits into
masterfrom
as/ttfx

Conversation

@AayushSabharwal

Copy link
Copy Markdown
Member

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Benchmark Results (Julia v1)

Time benchmarks
master 711172e... master / 711172e...
ODEProblem 13.8 ± 1.9 ms 19.8 ± 5.4 ms 0.698 ± 0.21
init 0.0825 ± 0.013 ms 0.159 ± 0.025 ms 0.519 ± 0.12
large_parameter_init/ODEProblem 0.0457 ± 0.0075 s 0.0568 ± 0.011 s 0.805 ± 0.21
large_parameter_init/init 0.0934 ± 0.012 ms 0.124 ± 0.046 ms 0.755 ± 0.3
mtkcompile 14.3 ± 1.6 ms 18.4 ± 2.7 ms 0.776 ± 0.14
sparse_analytical_jacobian/ODEProblem 0.0413 ± 0.0069 s 0.0533 ± 0.0098 s 0.776 ± 0.19
sparse_analytical_jacobian/f_iip 0.114 ± 0.004 μs 0.119 ± 0.001 μs 0.958 ± 0.035
sparse_analytical_jacobian/f_oop 0.19 ± 0.0063 ms 0.357 ± 0.2 ms 0.533 ± 0.29
time_to_load 9.99 ± 0.34 s 11.3 ± 3.2 s 0.882 ± 0.25
Memory benchmarks
master 711172e... master / 711172e...
ODEProblem 0.0432 M allocs: 2.34 MB 0.0435 M allocs: 2.34 MB 0.998
init 0.345 k allocs: 0.0447 MB 0.345 k allocs: 0.0447 MB 1
large_parameter_init/ODEProblem 0.261 M allocs: 9.98 MB 0.261 M allocs: 10 MB 0.993
large_parameter_init/init 0.685 k allocs: 0.144 MB 0.685 k allocs: 0.144 MB 1
mtkcompile 0.0621 M allocs: 2.71 MB 0.0621 M allocs: 2.71 MB 1
sparse_analytical_jacobian/ODEProblem 0.195 M allocs: 7.2 MB 0.196 M allocs: 7.24 MB 0.995
sparse_analytical_jacobian/f_iip 0 allocs: 0 B 0 allocs: 0 B
sparse_analytical_jacobian/f_oop 0.848 k allocs: 27 kB 0.848 k allocs: 27 kB 1
time_to_load 0.153 k allocs: 12 kB 0.153 k allocs: 12 kB 1

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Benchmark Results (Julia vlts)

Time benchmarks
master 711172e... master / 711172e...
ODEProblem 8.45 ± 0.17 ms 8.42 ± 0.077 ms 1 ± 0.022
init 0.0478 ± 0.026 ms 0.0541 ± 0.026 ms 0.885 ± 0.64
large_parameter_init/ODEProblem 24.4 ± 0.32 ms 24.5 ± 0.55 ms 0.995 ± 0.026
large_parameter_init/init 0.0669 ± 0.0024 ms 0.0672 ± 0.0027 ms 0.996 ± 0.054
mtkcompile 9.02 ± 0.068 ms 9.03 ± 0.082 ms 0.999 ± 0.012
sparse_analytical_jacobian/ODEProblem 27.7 ± 0.18 ms 27.6 ± 0.29 ms 1 ± 0.012
sparse_analytical_jacobian/f_iip 0.07 ± 0.01 μs 0.069 ± 0.01 μs 1.01 ± 0.21
sparse_analytical_jacobian/f_oop 0.347 ± 0.013 ms 0.345 ± 0.012 ms 1.01 ± 0.051
time_to_load 5.19 ± 0.061 s 5.82 ± 0.32 s 0.892 ± 0.051
Memory benchmarks
master 711172e... master / 711172e...
ODEProblem 0.046 M allocs: 2.72 MB 0.046 M allocs: 2.73 MB 0.998
init 0.384 k allocs: 0.065 MB 0.384 k allocs: 0.065 MB 1
large_parameter_init/ODEProblem 0.26 M allocs: 9.83 MB 0.26 M allocs: 9.83 MB 1
large_parameter_init/init 0.551 k allocs: 0.166 MB 0.551 k allocs: 0.166 MB 1
mtkcompile 0.0657 M allocs: 3.43 MB 0.0657 M allocs: 3.43 MB 1
sparse_analytical_jacobian/ODEProblem 0.209 M allocs: 8.39 MB 0.209 M allocs: 8.39 MB 1
sparse_analytical_jacobian/f_iip 0 allocs: 0 B 0 allocs: 0 B
sparse_analytical_jacobian/f_oop 0.634 k allocs: 19.6 kB 0.634 k allocs: 19.6 kB 1
time_to_load 0.153 k allocs: 14.7 kB 0.153 k allocs: 14.7 kB 1

Comment thread src/precompile.jl
@@ -0,0 +1,41 @@
include(pkgdir(ModelingToolkitBase, "src", "precompile.jl"))

@KristofferC KristofferC Jun 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for invalidation reasons?

Edit: Ok,I see this was already there before this PR.

module ModelingToolkitBase

if isdefined(Base, :Experimental) && isdefined(Base.Experimental, Symbol("@max_methods"))
@eval Base.Experimental.@compiler_options max_methods=1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Runic] reported by reviewdog 🐶

Suggested change
@eval Base.Experimental.@compiler_options max_methods=1
@eval Base.Experimental.@compiler_options max_methods = 1

Comment thread src/precompile.jl
sccprob = SCCNonlinearProblem(model, nothing)
solve(sccprob, SimpleNonlinearSolve.SimpleNewtonRaphson())
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Runic] reported by reviewdog 🐶

Suggested change

@AayushSabharwal AayushSabharwal merged commit 0648b9b into master Jun 22, 2026
102 of 147 checks passed
@AayushSabharwal AayushSabharwal deleted the as/ttfx branch June 22, 2026 08:23
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.

2 participants