evaluate! and set_eval_nodes! allocate a lot when evaluating on non-interpolation grids. This looks like a worthwhile optimization target.
Current code path
evaluate! currently does:
res.V, res.X = s_wise_max(...)
res.resid = res.V - vec(funeval(...))
set_eval_nodes! updates the stored evaluation nodes and then immediately calls evaluate!.
Possible directions
- make
evaluate! reuse preallocated V, X, and resid
- add an in-place evaluation path for the residual computation
- reduce temporary arrays created by
s_wise_max(...)
- keep API behavior the same while making internals more workspace-oriented
Related to existing discussion in #10.
(AI assisted (ChatGPT Pro 5.4) in drafting this issue)
evaluate!andset_eval_nodes!allocate a lot when evaluating on non-interpolation grids. This looks like a worthwhile optimization target.Current code path
evaluate!currently does:res.V, res.X = s_wise_max(...)res.resid = res.V - vec(funeval(...))set_eval_nodes!updates the stored evaluation nodes and then immediately callsevaluate!.Possible directions
evaluate!reuse preallocatedV,X, andresids_wise_max(...)Related to existing discussion in #10.
(AI assisted (ChatGPT Pro 5.4) in drafting this issue)