Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce memory bloating in FileMappedDict when reading metrics.
During the read path (metrics export) we open all existing metric files and read through them in order to aggregate metrics across different processes. When reading non-empty files we end up parsing file content twice: first during FileMappedDict initialisation, then again in the caller site (`all_values`). This commit refactors FileMappedDict so that while the `@positions` map is populated at creation time, the actual metric values are read only when explicitly requested. This avoids the memory bloat of unpacking file content twice.
- Loading branch information