[vfs][cpp] Allow in-place construction of node attributes

Refactor internal wire table builder so that we can eliminate extra
copies of node attribute data on the stack. Previously, the result of
calling Vnode::GetAttributes was required to be stored on the stack, as
it was assigned to an already constructed object. It also required
unpacking the `zx::result` variant, which further complicated elision
efforts.

This should provide minor performance improvements to the GitStatus and
StatPath benchmarks for memfs and f2fs.

By instead calling Vnode::GetAttributes in the constructor of the wire
table builder, we can ensure the compiler can optimize out the extra
copy. See https://godbolt.org/z/59ExM74br for a more generic example
that demonstrates this technique. Many thanks to the reviewers of
https://fxrev.dev/1194315, the discussion there was crucial in
discovering this approach.

Bug: 391921991
Test: No functional change.
Change-Id: I3d1b78df99cc8cbb98204bb06870824879fbf1a2
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1195918
Reviewed-by: Chris Drouillard <cdrllrd@google.com>
Commit-Queue: Brandon Castellano <bcastell@google.com>
7 files changed
tree: bd9bad9cd701785ce5b6c117ee155b1a471040c9
  1. .helix/
  2. boards/
  3. build/
  4. bundles/
  5. docs/
  6. examples/
  7. infra/
  8. products/
  9. scripts/
  10. sdk/
  11. src/
  12. third_party/
  13. tools/
  14. zircon/
  15. .clang-format
  16. .clang-tidy
  17. .editorconfig
  18. .git-blame-ignore-revs
  19. .gitattributes
  20. .gitignore
  21. .gitmodules
  22. .gn
  23. .ignore
  24. analysis_options.yaml
  25. AUTHORS
  26. BUILD.gn
  27. CODE_OF_CONDUCT.md
  28. CONTRIBUTING.md
  29. fuchsia.code-workspace
  30. LICENSE
  31. OWNERS
  32. PATENTS
  33. pyproject.toml
  34. pyrightconfig.json
  35. README.md
  36. rustfmt.toml
  37. shac.star
  38. 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.