Skip to content

Skip parameter args when rebuilding non-parameter array variables#4689

Merged
AayushSabharwal merged 1 commit into
SciML:masterfrom
KristofferC:kc/skip-param-args-in-array-reconstruction
Jul 1, 2026
Merged

Skip parameter args when rebuilding non-parameter array variables#4689
AayushSabharwal merged 1 commit into
SciML:masterfrom
KristofferC:kc/skip-param-args-in-array-reconstruction

Conversation

@KristofferC

Copy link
Copy Markdown
Contributor

build_function_wrapper reconstructs scalarized array variables in two passes: the parameters and everything else (unknowns, cache vars, the independent variable). The second pass walked the parameter args as well, running split_indexed_var on every parameter symbol and then throwing the result away because parameters are already handled by the cache.

This makes ODEProblem on a large model go from

16.499893 seconds (267.38 M allocations: 9.314 GiB, 15.51% gc time)

to

12.312885 seconds (212.77 M allocations: 7.851 GiB, 18.16% gc time)

`build_function_wrapper`` reconstructs scalarized array variables in two
passes: the parameters (whose layout is cached and reused) and everything
else (unknowns, cache vars, the independent variable). The second pass
walked the parameter args as well, running split_indexed_var on every
parameter symbol and then throwing the result away because parameters are
already handled by the cache.
@AayushSabharwal AayushSabharwal merged commit 082e76d into SciML:master Jul 1, 2026
69 of 89 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.

2 participants