Skip to content

Reduce allocations in evaluate! and set_eval_nodes! #74

Description

@oyamad

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions