Skip to content

potential: allocate persistent scratch space for gradients#591

Open
lgarrison wants to merge 1 commit into
mainfrom
grad-scratch
Open

potential: allocate persistent scratch space for gradients#591
lgarrison wants to merge 1 commit into
mainfrom
grad-scratch

Conversation

@lgarrison

Copy link
Copy Markdown
Collaborator

Avoid repeated malloc/free calls when calculating gradients with transformed components. Uses thread-local scratch space that is allocated on first use and cached for reuse later.

Note that this space is never freed! If working with large orbit arrays, this may result in higher than expected persistent memory usage.

This is an alternate fix to #588.

@segasai, would you mind profiling this branch to see if it resolves your original issue?

Describe your changes

Checklist

  • Did you add tests?
  • Did you add documentation for your changes?
  • Did you reference any relevant issues?
  • Did you add a changelog entry? (see CHANGES.rst)
  • Are the CI tests passing?
  • Is the milestone set?

Avoid repeated malloc/free calls when calculating gradients with
transformed components. Uses thread-local scratch space that is allocated
on first use and cached for reuse later.

Note that this space is never freed! If working with large orbit arrays,
this may result in higher than expected memory usage.
@adrn adrn added the benchmark label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants