Skip to content

0.1.4: Added a new method to return buffered binary encoder (#19)

Compare
Choose a tag to compare
@radai-rosenblatt radai-rosenblatt released this 31 Jan 18:32
· 395 commits to master since this release
eab8395
* Added a new method to return buffered binary encoder

In Avro-1.7 and above, the default BinaryEncoder implementation is buffered,
which has improved the serialization greatly, but this optimization is
absent in Avro-1.4.
To improve the serialization performance in Avro-1.4, this code change back-ports
the buffered binary encoder implementation from Avro-1.8 to be used
in Avro-1.4.
By running the test: SerDeMicroBenchmark#testFastAvroSerialization with Avro-1.4,
the performance is improved by more than 40% with the new buffered binary encoder (5ms vs 9ms).
With the buffered binary encoder, the fast serialization performance across
all the Avro versions are very similar now.

This code change doesn't change the signature of AvroCompatibilityHelper#newBinaryEncoder,
since we would like to keep it backward compatible, instead it adds a new method:
AvroCompatibilityHelper#newBufferedBinaryEncoder to return a `Encoder` instance instead
of `BinaryEncoder`.
The reason of not returning `BinaryEncoder` in the new method is that `BinaryEncoder` has
different kinds of contructors across different Avro versions, and it is not easy to backport
the buffered binary encoder to work with BinaryEncoder interface in Avro-1.4.

* Fixed Javadoc errors