commit | 1e92ba38b7f3b5664f268ae123ed635a6ca47a2b | [log] [tgz] |
---|---|---|
author | Gary Bressler <geb@google.com> | Fri May 30 11:14:16 2025 -0700 |
committer | CQ Bot <fuchsia-internal-scoped@luci-project-accounts.iam.gserviceaccount.com> | Fri May 30 11:14:16 2025 -0700 |
tree | 0677de3fe8747c019a1c46aeb73b4fda1892d1f1 | |
parent | 496a6feaee3eace5b7359be2864728872d6e555f [diff] |
[component_manager] Optimize Dict memory usage This commit changes the internal representation of Dict from a BTreeMap to one of {Vec, BTreeMap}. The data structure will transform itself from a Vec to a BTreeMap once it grows to a certain size, and vice versa when it shrinks to a certain size. These sizes are determined by constants defined in dict.rs. This commit does not impact any of Dict's interfaces. In particular, interfaces that returned results in sorted order before still do. However, the runtime performance of some methods changes slightly. On core.x64 this appears to save 3 MiB give or take in debug. The amount of memory that can be saved depends on the build and should be roughly proportionate to the number of components in the topology. Also backfilled some missing unit tests. Bug: 419024317 Change-Id: I3b2344fa54101d82f6b5526067a4eb1d13bb2f4e Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1282667 Commit-Queue: Gary Bressler <geb@google.com> Reviewed-by: Claire Gonyeo <cgonyeo@google.com>
Fuchsia is an open source, general purpose operating system supporting modern 64-bit Intel and ARM processors.
We expect everyone interacting with our project to respect our code of conduct.
Read more about Fuchsia's principles.
See Getting Started.
See fuchsia.dev.