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

Reduce size of submap by changing submap::camp to unique_ptr #34938

Merged
merged 5 commits into from Oct 25, 2019

Conversation

OrenAudeles
Copy link
Contributor

Summary

SUMMARY: Infrastructure "Reduce submap size by changing submap's camp member to unique_ptr"

Purpose of change

Reduce size of submap instance by replacing embedded basecamp with as-needed allocation of basecamp.

Describe the solution

Change submap's camp member from basecamp to std::unique_ptr<basecamp> so that we do not pay the memory cost of a basecamp for every submap instance, even when that basecamp is not considered valid. Switching from basecamp to std::unique_ptr<basecamp> reduces the size of submap by ~28%.

Additional context

Most submaps do not have valid basecamps. Embedding basecamp (8704 Bytes) that are not used by most submaps is wasteful and unnecessary. Without z-levels enabled, the reality bubble (11x11 submaps) will use 1053184 Bytes, just over 1 MiB, on basecamp data with most/all of it in an invalid state. With z-levels enabled this increases to 22116864 Bytes, ~21.09 MiB, of basecamp data for submaps within the reality bubble.

@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Code: Performance Performance boosting code (CPU, memory, etc.) Player Faction Base / Camp All about the player faction base/camp/site labels Oct 23, 2019
@kevingranade kevingranade merged commit 8e3afe5 into CleverRaven:master Oct 25, 2019
@OrenAudeles OrenAudeles deleted the submap_basecamp branch October 25, 2019 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Performance Performance boosting code (CPU, memory, etc.) Player Faction Base / Camp All about the player faction base/camp/site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants