-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide "decode" code generation for the streaming variants for all o…
…ther types Provide the streaming read generators for all of the other types. Doing so meant providing a `StreamGenerator` that plumbs into the existing generators. This `StreamGenerator` only provides the "decoding" mechanism, leveraging #491 for reading the raw Thrift encoding off of the wire. In addition to providing a `StreamGenerator`, the list, map, set, enum, typdef, and struct generators all added a `Decoder` method that will appropriately recurse and iterate to generate the proper, mirrored readers for the raw wire representation. The `Decode` and `DecodePtr` methods for `StreamGenerator` then hook into the templated generator itself, providing the templated `decode` and `decodePtr` calls that will be used where necessary. The existing tests were leveraged to make sure that the streaming reads were compatible with the current binary writes and that no data was lost. In doing so, a 'genericized' function that will perform the cross-products of encoding/writing and decoding/reading. A benchmark was also added to evaluate the new streaming reads. ``` name \ time/op old.txt new.txt stream.txt RoundTrip/PrimitiveOptionalStruct/Encode-8 1.72µs ± 5% 1.72µs ± 0% 1.76µs ± 6% RoundTrip/PrimitiveOptionalStruct/Decode-8 2.47µs ± 1% 2.75µs ± 0% 2.68µs ± 1% RoundTrip/Graph/Encode-8 3.18µs ± 2% 3.13µs ± 1% 3.13µs ± 1% RoundTrip/Graph/Decode-8 5.02µs ± 2% 8.34µs ± 2% 8.35µs ± 2% RoundTrip/ContainersOfContainers/Encode-8 19.5µs ± 3% 19.0µs ± 2% 19.3µs ± 2% RoundTrip/ContainersOfContainers/Decode-8 46.8µs ± 5% 104.8µs ± 1% 106.7µs ± 2% RoundTrip/PrimitiveOptionalStruct/StreamingRead-8 1.09µs ± 1% RoundTrip/Graph/StreamingRead-8 1.69µs ± 4% RoundTrip/ContainersOfContainers/StreamingRead-8 25.3µs ± 2% name \ alloc/op old.txt new.txt stream.txt RoundTrip/PrimitiveOptionalStruct/Encode-8 704B ± 0% 704B ± 0% 704B ± 0% RoundTrip/PrimitiveOptionalStruct/Decode-8 1.40kB ± 0% 1.46kB ± 0% 1.46kB ± 0% RoundTrip/Graph/Encode-8 1.70kB ± 0% 1.70kB ± 0% 1.70kB ± 0% RoundTrip/Graph/Decode-8 2.78kB ± 0% 3.57kB ± 0% 3.57kB ± 0% RoundTrip/ContainersOfContainers/Encode-8 1.30kB ± 0% 1.30kB ± 0% 1.30kB ± 0% RoundTrip/ContainersOfContainers/Decode-8 12.3kB ± 0% 28.6kB ± 0% 28.6kB ± 0% RoundTrip/PrimitiveOptionalStruct/StreamingRead-8 104B ± 0% RoundTrip/Graph/StreamingRead-8 216B ± 0% RoundTrip/ContainersOfContainers/StreamingRead-8 10.2kB ± 0% name \ allocs/op old.txt new.txt stream.txt RoundTrip/PrimitiveOptionalStruct/Encode-8 1.00 ± 0% 1.00 ± 0% 1.00 ± 0% RoundTrip/PrimitiveOptionalStruct/Decode-8 14.0 ± 0% 15.0 ± 0% 15.0 ± 0% RoundTrip/Graph/Encode-8 11.0 ± 0% 11.0 ± 0% 11.0 ± 0% RoundTrip/Graph/Decode-8 32.0 ± 0% 63.0 ± 0% 63.0 ± 0% RoundTrip/ContainersOfContainers/Encode-8 18.0 ± 0% 18.0 ± 0% 18.0 ± 0% RoundTrip/ContainersOfContainers/Decode-8 164 ± 0% 837 ± 0% 837 ± 0% RoundTrip/PrimitiveOptionalStruct/StreamingRead-8 11.0 ± 0% RoundTrip/Graph/StreamingRead-8 11.0 ± 0% RoundTrip/ContainersOfContainers/StreamingRead-8 147 ± 0% ``` "old" represents the original code, "new" represents the binary decoding utilizing the streaming decoder, and "stream" represents the benchmarks as it stands at this diff.
- Loading branch information
Showing
35 changed files
with
9,448 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.