Make uniform submaps Copy On Write #29674
Labels
[C++]
Changes (can be) made in C++. Previously named `Code`
Character / World Generation
Issues and enhancements concerning stages of creating a character or a world
Code: Performance
Performance boosting code (CPU, memory, etc.)
Map / Mapgen
Overmap, Mapgen, Map extras, Map display
(P5 - Long-term)
Long-term WIP, may stay on the list for a while.
Is your feature request related to a problem? Please describe.
We waste a non-trivial amount of memory because "uniform" submaps each contain a copy of the submap data, even though it's totally redundant.
Describe the solution you'd like
Establish a cache of immutable uniform submaps.
When a uniform submap is generated, check for a match in the cache, if present just use that pointer, if not, insert a copy of the submap and capture the pointer.
If a uniform submap is written to, replace it with a copy of the uniform submap before writing to it.
The text was updated successfully, but these errors were encountered: