Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading memory tweaks #20913

Merged
merged 2 commits into from Jun 13, 2023
Merged

Loading memory tweaks #20913

merged 2 commits into from Jun 13, 2023

Conversation

RoosterDragon
Copy link
Member

Two minor changes to assist with memory usage identifed during profiling of loading performance.


In HierarchicalPathFinder.BuildGrid, presize and reuse accessible cell set.

Most cells are accessible, so presizing to the full size of the grid is sensible to avoid allocations to resize as it is filled up. The set can also be reused across all layers to avoid allocating it many times.


In TypeDictionary.TrimExcess, also TrimExcess on the internal data dictionary size.

As TypeDictionary instances tend to live a long time without edits after being initially populated, this will reduce their long term memory footprint.

…l set.

Most cells are accessible, so presizing to the full size of the grid is sensible to avoid allocations to resize as it is filled up. The set can also be reused across all layers to avoid allocating it many times.
…ctionary size.

As TypeDictionary instances tend to live a long time without edits after being initially populated, this will reduce their long term memory footprint.
Copy link
Member

@PunkPun PunkPun left a comment

Choose a reason for hiding this comment

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

LGTM

@abcdefg30 abcdefg30 merged commit f794cf6 into OpenRA:bleed Jun 13, 2023
3 checks passed
@abcdefg30
Copy link
Member

Changelog

@RoosterDragon RoosterDragon deleted the load-mem branch June 14, 2023 06:38
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.

None yet

3 participants