| commit | 0e98806859c83c5c5159a2d0173bb5b5c99d85bb | [log] [tgz] |
|---|---|---|
| author | Yifei Teng <yifeit@fuchsia.infra.roller.google.com> | Fri Nov 11 20:38:31 2022 +0000 |
| committer | Copybara-Service <copybara-worker@google.com> | Fri Nov 11 12:39:42 2022 -0800 |
| tree | 2a8d32980f355aa8db353bc25c7b76b9755e13b2 | |
| parent | b440aa7054af2ddaf9bce885cc16ba3abb00fd03 [diff] |
[roll] Roll fuchsia [fidl][cpp] Stable Encode API for wire types
The primary goal is two-fold:
- Disallow the user from specifying the wire format version. This will
help us in any future potential wire format changes since the FIDL
library will be in control of which version to use.
- Simplify the API. The many {Unowned,Owned}EncodedMessage classes have
a very convoluted API. This CL brings us something much simpler:
fidl::OwnedEncodeResult result = fidl::Encode(some_object);
It's done by generalizing the existing natural type encoding API to wire
types, using a type erasure helper to hold the different message types.
If the user passes a natural domain object to |fidl::Encode|, it would
internally use the natural encoding logic. If the user passes a wire
domain object, it would use the wire encoding logic.
Performance: the IPC messaging code would not be using |fidl::Encode|.
Instead, it would use the more complicated {Unowned,Owned}EncodedMessage
and also activate vectorization. Thus we are not yet benchmarking
|fidl::Encode|. However, we can measure the performance by changing
the fast UDP library, which does utilize direct encoding, over to this
API in I8e3a684bf872f9a89df9be9fc445203db57655a6. It adds at most 33
nanoseconds of overhead, which is expected of the type erasure
abstraction but not that ideal. I found that there's a bug in our inline
buffer allocation condition -- it checks if the V1 size is bigger than
512 bytes, instead of V2 which is what's being used in practice. After
fixing that, the RecvMsgMeta encoding buffer is allocated inline instead
of boxed. That makes it >100ns faster.
Benchmarks are reproduced here (best viewed if copy out of the gerrit website):
Performance (PS 6): tested changing the fast UDP library over to this API in
I8e3a684bf872f9a89df9be9fc445203db57655a6. It adds at most 33
nanoseconds of overhead.
fuchsia.network.udp_serde: RecvMsgMeta/Serialize/IPv4/Empty slower 1.074-1.089 411.16 +/- 0.46 ns 444.7 +/- 2.5 ns
fuchsia.network.udp_serde: RecvMsgMeta/Serialize/IPv4/Full slower 1.049-1.079 533.2 +/- 5.1 ns 567.2 +/- 2.4 ns
fuchsia.network.udp_serde: RecvMsgMeta/Serialize/IPv6/Empty slower 1.070-1.085 413.6 +/- 2.5 ns 445.58 +/- 0.40 ns
fuchsia.network.udp_serde: RecvMsgMeta/Serialize/IPv6/Full slower 1.038-1.071 557.8 +/- 5.9 ns 588.1 +/- 3.0 ns
fuchsia.network.udp_serde: RecvMsgMeta/SerializeThenDeserialize/IPv4/Empty slower 1.045-1.056 515.5 +/- 2.2 ns 541.67 +/- 0.51 ns
fuchsia.network.udp_serde: RecvMsgMeta/SerializeThenDeserialize/IPv4/Full slower 1.030-1.043 759.8 +/- 4.0 ns 787.34 +/- 0.65 ns
fuchsia.network.udp_serde: RecvMsgMeta/SerializeThenDeserialize/IPv6/Empty slower 1.051-1.055 516.34 +/- 0.80 ns 543.68 +/- 0.28 ns
fuchsia.network.udp_serde: RecvMsgMeta/SerializeThenDeserialize/IPv6/Full slower 1.027-1.042 796.8 +/- 4.0 ns 824.6 +/- 1.8 ns
fuchsia.network.udp_serde: SendMsgMeta/Serialize/IPv4/Empty slower 1.067-1.094 235.37 +/- 0.78 ns 254.2 +/- 2.4 ns
fuchsia.network.udp_serde: SendMsgMeta/Serialize/IPv4/Full slower 1.057-1.072 319.7 +/- 2.1 ns 340.40 +/- 0.18 ns
fuchsia.network.udp_serde: SendMsgMeta/Serialize/IPv6/Empty slower 1.060-1.093 235.3 +/- 1.2 ns 253.3 +/- 2.6 ns
fuchsia.network.udp_serde: SendMsgMeta/Serialize/IPv6/Full slower 1.062-1.068 330.73 +/- 0.48 ns 352.17 +/- 0.46 ns
fuchsia.network.udp_serde: SendMsgMeta/SerializeThenDeserialize/IPv4/Empty slower 1.069-1.075 298.59 +/- 0.73 ns 320.01 +/- 0.15 ns
fuchsia.network.udp_serde: SendMsgMeta/SerializeThenDeserialize/IPv4/Full slower 1.040-1.053 503.43 +/- 0.75 ns 526.9 +/- 2.4 ns
fuchsia.network.udp_serde: SendMsgMeta/SerializeThenDeserialize/IPv6/Empty slower 1.072-1.075 298.20 +/- 0.26 ns 319.98 +/- 0.17 ns
fuchsia.network.udp_serde: SendMsgMeta/SerializeThenDeserialize/IPv6/Full slower 1.041-1.047 537.97 +/- 0.77 ns 561.65 +/- 0.60 ns
Performance (PS 7, after adding some optimizations):
fuchsia.network.udp_serde: RecvMsgMeta/Serialize/IPv4/Empty slower 1.050-1.091 327.5 +/- 4.8 ns 350.5 +/- 1.6 ns
fuchsia.network.udp_serde: RecvMsgMeta/Serialize/IPv6/Empty slower 1.053-1.101 328.4 +/- 6.2 ns 353.5 +/- 1.2 ns
fuchsia.network.udp_serde: RecvMsgMeta/Serialize/IPv6/Full slower 1.009-1.082 468 +/- 15 ns 488.9 +/- 1.3 ns
fuchsia.network.udp_serde: RecvMsgMeta/SerializeThenDeserialize/IPv4/Empty slower 1.029-1.082 427.8 +/- 6.2 ns 451.5 +/- 4.8 ns
fuchsia.network.udp_serde: RecvMsgMeta/SerializeThenDeserialize/IPv6/Empty slower 1.028-1.082 429.6 +/- 5.6 ns 453.2 +/- 5.8 ns
fuchsia.network.udp_serde: SendMsgMeta/Serialize/IPv4/Empty slower 1.102-1.192 236.3 +/- 8.4 ns 270.7 +/- 1.0 ns
fuchsia.network.udp_serde: SendMsgMeta/Serialize/IPv4/Full slower 1.078-1.131 319.5 +/- 7.5 ns 352.71 +/- 0.17 ns
fuchsia.network.udp_serde: SendMsgMeta/Serialize/IPv6/Empty slower 1.093-1.201 235.9 +/- 8.8 ns 270.1 +/- 2.6 ns
fuchsia.network.udp_serde: SendMsgMeta/Serialize/IPv6/Full slower 1.074-1.113 331.8 +/- 5.6 ns 362.81 +/- 0.35 ns
fuchsia.network.udp_serde: SendMsgMeta/SerializeThenDeserialize/IPv4/Empty slower 1.088-1.145 298.5 +/- 7.4 ns 333.07 +/- 0.29 ns
fuchsia.network.udp_serde: SendMsgMeta/SerializeThenDeserialize/IPv4/Full slower 1.058-1.072 503.6 +/- 3.0 ns 536.21 +/- 0.26 ns
fuchsia.network.udp_serde: SendMsgMeta/SerializeThenDeserialize/IPv6/Empty slower 1.096-1.153 298.5 +/- 7.1 ns 335.41 +/- 0.45 ns
fuchsia.network.udp_serde: SendMsgMeta/SerializeThenDeserialize/IPv6/Full slower 1.050-1.070 545.0 +/- 4.3 ns 577.64 +/- 0.87 ns
Original-Bug: 82681
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/756422
Original-Revision: ee79d6b197b5041de04178fbda04faafc23c832c
GitOrigin-RevId: 08f97bce4c6fc1d2553beeb8127811e35406182c
Change-Id: Ide6fa40bf61238d2f27d03be2f45aff0ebb9d802
This repository contains Fuchsia's Global Integration manifest files.
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.
First install Jiri.
Next run:
$ jiri init $ jiri import minimal https://fuchsia.googlesource.com/integration $ jiri update
Third party projects should have their own subdirectory in ./third_party.