The changes to ParserUtils were fumbled and broke BinaryProtocolBenchmark,
which is the more valuable benchmark. UnionSerializationBenchmark was used to
check the performance impact of a particular commit and isn't really worth
maintaining.
* Match unions with zero or one field set
This uses matching in the `serialize` definition to enforce that only unions
with zero or one field can be serialized.
A pure Elixir implementation of the Thrift binary protocol.
This PR includes serialization and deserialization for all thrift types as well as testing to make sure we match the thrift spec (which can be found here: https://erikvanoosten.github.io/thrift-missing-specification/#_binary_encoding)
The binary protocol is generated alongside the thrift data types, yielding a much faster implementation than the apache project's canonical one.
Our benchmarks (using benchfella) indicate a speedup of between 10 and 20x.
## Binary Protocol Performance
benchmark name | iterations | average time
------------------|-----------|---------------
elixir serialization (left as IOList) | 2000 | 849.01 µs/op
elixir serialization (iolist_size) | 2000 | 933.83 µs/op
elixir serialization (converted to binary) | 1000 | 1281.23 µs/op
elixir deserialization | 1000 | 1178.46 µs/op
erlang serialization left as IOList | 100 | 10284.84 µs/op
erlang serialization (converted to binary) | 100 | 11588.89 µs/op
erlang deserialization | 100 | 21433.17 µs/op