-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(changelog): reduce mem footprint
The current Changelog structure consumes a significant amount of memory due to the allocation of metadata for each field/instance. As the number of fields increases, the memory usage grows linearly. Approximately 240 bytes per field were observed just for metadata, excluding the actual data and pointers for each field. To reduce memory consumption, the new changelog.Entries[T] implementation uses a flat slice of T type instead of storing metadata for each field separately. --- | Caches | GOGC | Branch | *Heap Use | *Heap | Diff of | Proctree | | | | | (Avg) | Growth | main | | |--------|------|--------|--------- -|------- -|---------|----------| | - | - | main | 28 | - | - | off | | 16384 | - | main | 199 | 171 | - | on | | 32768 | - | main | 331 | 303 | - | on | | - | 5 | main | 18 | - | - | off | | 16384 | 5 | main | 125 | 107 | - | on | | 32768 | 5 | main | 209 | 191 | - | on | |---------------------------------- --------- ----------------------| | - | - | new | 28 | - | - | off | | 16384 | - | new | 111 | 83 | -51.46% | on | | 32768 | - | new | 158 | 130 | -57.10% | on | | - | 5 | new | 18 | - | - | off | | 16384 | 5 | new | 72 | 54 | -49.53% | on | | 32768 | 5 | new | 102 | 84 | -56.02% | on | * in MB With GOGC set to 5, the new implementation reduces average heap usage by approximately 49% when using cache sizes of 16,384. For cache sizes of 32,768, the reduction is around 56%. When GOGC is set to the default value, the reductions are roughly 51% and 57% for cache sizes of 16,384 and 32,768, respectively. The "Heap Use" and "Heap Growth" columns serve as a good indicator of memory consumption and can assist in determining optimal cache sizes.
- Loading branch information
Showing
6 changed files
with
815 additions
and
805 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.