PoolOpt

v0.9.3·Updated 2023-09-04

Optimize memory pools on loading gamesaves / Optimize the use of memory pools when loading game saves

About this mod Machine translation

PoolOpt

Optimize memory pools on loading gamesaves

Optimize memory pool usage when loading game saves

Changelog

  • 0.9.3

+ Fix crash on calling SetEntityCapacity()

+ Reduce copies of Lists to improve performance

  • 0.9.2

+ Fix a issue that may delete used slots in trash pool

+ Fix compatibility issue with other mods (expecially DSPOptimizations) by calling SetXXXCapacity() on shrinking capacity of pools

  • 0.9.1

+ Fix a bug that may cause game crash on shrinking storage memory pools.

Notes

  • Does not optimize some rarely uses pools, mostly UI related.
  • Does not optimize solar sails' pool, please use button on dyson sphere panel from original game to clean it up.

Mechanism

  • The game uses a lot of memory pools in array to store data, sizes and capacities of these pools are increased on demand but never decreased, even most data inside are not used due to dismantle objects. Unused slot IDs are save in recycle array for reuse.
  • Some game functions loop through all allocated slots in the pool, so the size of the pool will affect the performance.
  • This mod will optimize the memory pools when loading gamesaves, strip the unused slots from tail and reduce the size of the pool and recycle array, for better performance.

TODO

  • Remove the unused slots from middle of the pool, which leads to ID change for stored objects, needs more investigation.

illustrate

  • Some rarely used memory pools will not be optimized, mainly UI related.
  • The solar sail's memory pool will not be optimized, please use the button on the Dyson Sphere panel in the original game to clean it up.

principle

  • The game uses a large number of memory pool arrays to store data. The size and capacity of these memory pools will only expand and not shrink with demand, even if most of the internal data is no longer used due to the removal of objects. Unused slot IDs will be saved in the recycling array for reuse.
  • Some game features will loop through all allocated slots in the memory pool, so the size of the memory pool will affect performance.
  • This MOD will optimize the memory pool when loading game saves, remove unused slots at the end, and reduce the size of the memory pool array and recycling array to obtain better performance.

TODO

  • Remove unused slots in the middle of the memory pool. This will cause the storage ID of the object to change and requires further investigation.

Install & use Install: BepInEx plugin

  1. The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
  2. Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
  3. Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
  4. Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.

Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file.

Dependencies

Install these first, or the mod will not work:

xiaoye97-BepInEx

File & checksum

Filename
PoolOpt-0.9.3.zip
File size
17.3 KiB