[hierarchy][fixes] Squash two diagnostics optimizations

First optimization:

[hierarchy] Remove usage of regexes in select_from_hierarchy

`select_from_hierarchy` was previously executing a `filter_hierarchy`.
In the case of Sampler, this wasn't necessary since Sampler receives
hierarchies that have been filtered by the Archivist.

In the case of triage, there's no need to filter the whole hierarchy and
then collect the properties into a vector, we can instead get the
properties as we traverse the hierarchy in a DFS way.

This still doesn't remove usage of RegexSet in the Archivist but it does
for Sampler.

Additionally the new implementation removes cloning of data and returns
the selected properties in a hierarchy as references to the original
hierarchy. There's some cloning still in triage that might be possible
to optimize into dealing with references, but that's out of scope of
this CL as Sampler is the main target.

This refactor brings back ~300K in Sampler:
https://screenshot.googleplex.com/WXqGbYVzNzV5FwN.png.

Bug: 117157
Run-All-Tests: True

Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/777862
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Reviewed-by: Christopher Johnson <crjohns@google.com>
Fuchsia-Auto-Submit: Miguel Flores <miguelfrde@google.com>

Second optimization:

[hierarchy] Remove regex sets and cloning from filter_hierarchy

filter_hierarchy is no longer implemented using regexes. Additionally,
it now performs filtering of the input hierarchy in-place instead of
copying the data over to a new result hierarchy.

Together with fxrev.dev/779483 and fxrev.dev/777862 I see the
following improved memory usage in archivist: https://screenshot.googleplex.com/C8DVzCVQHo9Womm.png

This also improves the SnapshotAndSelect benchmarks significantly:

```
fuchsia.rust_inspect.selectors: SnapshotAndSelect/10                             faster            0.048-0.049    517522 +/- 4446 ns  25148 +/- 174 ns
fuchsia.rust_inspect.selectors: SnapshotAndSelect/100                            faster            0.054-0.055    123560 +/- 864 ns   6739 +/- 69 ns
fuchsia.rust_inspect.selectors: SnapshotAndSelect/1000                           faster            0.049-0.051    183722 +/- 1524 ns  9245 +/- 98 ns
fuchsia.rust_inspect.selectors: SnapshotAndSelect/10000                          faster            0.048-0.049    242915 +/- 1270 ns  11695 +/- 32 ns
fuchsia.rust_inspect.selectors: SnapshotAndSelect/100000                         faster            0.048-0.049    271898 +/- 1749 ns  13254 +/- 65 ns
```

Run-All-Tests: True
Bug: 117157

Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/776883
Reviewed-by: Christopher Johnson <crjohns@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Fuchsia-Auto-Submit: Miguel Flores <miguelfrde@google.com>
Change-Id: Ife0f98a6f3c6d5aa81e39b379e30273926135f00
9 files changed
tree: 00b60699aca9006d74fac90cd8baba3247efe2ae
  1. boards/
  2. build/
  3. bundles/
  4. docs/
  5. examples/
  6. products/
  7. scripts/
  8. sdk/
  9. src/
  10. third_party/
  11. tools/
  12. zircon/
  13. .clang-format
  14. .clang-tidy
  15. .editorconfig
  16. .git-blame-ignore-revs
  17. .gitattributes
  18. .gitignore
  19. .gn
  20. .style.yapf
  21. analysis_options.yaml
  22. AUTHORS
  23. BUILD.gn
  24. CODE_OF_CONDUCT.md
  25. CONTRIBUTING.md
  26. LICENSE
  27. OWNERS
  28. PATENTS
  29. pyrightconfig.json
  30. README.md
  31. rustfmt.toml
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.