Skip to content

Use std::array to reduce allocations in ManagedArray::operator()#1429

Open
janbridley wants to merge 5 commits into
mainfrom
feat/remove-allocation-from-managedarray-index
Open

Use std::array to reduce allocations in ManagedArray::operator()#1429
janbridley wants to merge 5 commits into
mainfrom
feat/remove-allocation-from-managedarray-index

Conversation

@janbridley

@janbridley janbridley commented May 8, 2026

Copy link
Copy Markdown
Contributor

Description

As noted in a now-removed comment, the use of std::vector in operator() for managed arrays could be a performance bottleneck. This was particularly obvious in order/Nematic, but is also true of SolidLiquid and probably other OPs. This fix retains the original vector indexing where needed, but defaults to std::array for allocation-free indexing.

Motivation and Context

Resolves: #???

How Has This Been Tested?

Checklist:

@janbridley janbridley changed the title Use std::array in ManagedArray::operator() Use std::array to reduce allocations in ManagedArray::operator() May 8, 2026
@janbridley
janbridley marked this pull request as ready for review May 8, 2026 01:08

@joaander joaander left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This one also needs a change log.

Base automatically changed from optimize/nematic-allocations to main May 8, 2026 14:03
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