Optimizing model description

I need to optimize a model description for an ODEProblem, which is a hand-coded discretization of a PDE (so the state is a matrix). I know I should…

  • avoid creating arrays in the model. My plan is to instead operate on a work array which is an input parameter to the model, and define readable array names via a view

At a later stage, I’ll probably convert the problem to a DAEProblem to store intermediate variables. When doing so, the problem disappears (I guess), in that then the arrays will be part of the u (and du) array.

What I’m curious about is the following: in the model function, I call a number of other functions.

  • Is it advantageous to pass these functions into the model function via the parameter argument, or is there no loss of performance when the function is only defined in the “global” namespace?