[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>
5 files changed
tree: 0677de3fe8747c019a1c46aeb73b4fda1892d1f1
  1. .fx/
  2. .helix/
  3. boards/
  4. build/
  5. bundles/
  6. docs/
  7. examples/
  8. manifests/
  9. products/
  10. scripts/
  11. sdk/
  12. src/
  13. third_party/
  14. tools/
  15. zircon/
  16. .clang-format
  17. .clang-tidy
  18. .editorconfig
  19. .git-blame-ignore-revs
  20. .gitattributes
  21. .gitignore
  22. .gitmodules
  23. .gn
  24. .ignore
  25. analysis_options.yaml
  26. AUTHORS
  27. BUILD.gn
  28. CODE_OF_CONDUCT.md
  29. CONTRIBUTING.md
  30. fuchsia.code-workspace
  31. LICENSE
  32. OWNERS
  33. PATENTS
  34. pyproject.toml
  35. pyrightconfig.json
  36. README.md
  37. rustfmt.toml
  38. shac.star
  39. shac.textproto
README.md

Fuchsia

What is Fuchsia?

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.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See fuchsia.dev.