[roll] Roll fuchsia [fidl] Memcpy natural type structs during encode / decode

This implements an optimization that exists for other FIDL
bindings: replace encode / decode logic with a simple memcpy
where possible for structs / arrays.

This also has been seen to significantly decrease code size.

This was previously partially implemented for arrays through
the NaturalIsMemcpyCompatible trait, but this trait has
been replaced with a field on NaturalCodingTrait because:
- It reuses the existing coding trait.
- It keeps logic closer to the "decision point" on whether
the optimization is possible. For instance, for enums and
bits memcpy compatibility depends on strictness and this
logic is now kept in the same point as the encode / decode
logic.
- Since we already are traversing struct fields via
templates for encode / decode, use a similar logic structure
via templates to determine memcpy compatibility, rather
than separating this logic and placing it into fidlgen.

Rust also supports applying padding after performing memcpy,
making it possible to copy structs and then check padding
afterwards, but this is deferred to a later time for
simplicity.

This logic may also be possible to re-use to support iovec
if it ever is supported for unified bindings.

Performance difference.
CPP/Decode/StructField/16/Steps.Decode/WallTime                        faster            0.326-0.354    90.60 +/- 0.36 ns           30.8 +/- 1.1 ns
CPP/Decode/StructField/256/Steps.Decode/WallTime                       faster            0.015-0.016    4409 +/- 86 ns              69.33 +/- 0.69 ns
CPP/Decode/StructTree/Depth8/Steps.Decode/WallTime                     faster            0.061-0.063    1107.1 +/- 1.2 ns           68.77 +/- 0.79 ns
CPP/Encode/StructField/16/Steps.Encode/WallTime                        faster            0.790-0.792    209.96 +/- 0.14 ns          166.09 +/- 0.17 ns
CPP/Encode/StructField/256/Steps.Encode/WallTime                       faster            0.085-0.090    2113 +/- 53 ns              184.9 +/- 1.1 ns
CPP/Encode/StructTree/Depth8/Steps.Encode/WallTime                     faster            0.259-0.262    710.4 +/- 1.4 ns            184.92 +/- 0.91 ns

Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/660108
Original-Revision: dd637de0e3961eb0d4ef6251f842eb86e42da40f
GitOrigin-RevId: f686363e7a4646918e2264a1c18e242afaa47b2a
Change-Id: I4d57da2d408e5a055d8fd996b9e4284ce22c6d35
1 file changed
tree: 5a3cd97ec5c12210cefb6bf92f143a81ffad1bab
  1. infra/
  2. third_party/
  3. cts
  4. firmware
  5. flower
  6. jiri.lock
  7. minimal
  8. prebuilts
  9. README.md
  10. stem
  11. test_durations
  12. toolchain
README.md

Integration

This repository contains Fuchsia's Global Integration manifest files.

Making changes

All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.

Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance via the IRC channel #fuchsia on Freenode.

Obtaining the source

First install Jiri.

Next run:

$ jiri init
$ jiri import minimal https://fuchsia.googlesource.com/integration
$ jiri update

Third party

Third party projects should have their own subdirectory in ./third_party.