Hello,

I have been working on adding Java record support and some additional features 
around polymorphic and faster code bindings.


The PR that adds support for records can be found here.

https://github.com/apache/avro/pull/1680

I have built some additional features on top of this PR.

Automatic polymorphic support of using sealed classes.

https://github.com/ashley-taylor/avro/pull/1

Additionally, being looking into improving the performance of the record 
implementation.
I have taken inspiration from the FastReaderBuilder approach to create a direct 
encoding/decoding tree for simple cases.

Available for review here
https://github.com/ashley-taylor/avro/pull/3

Performance improvements are reasonably minor and situational but allow the 
following PR.


Dynamic Code Generation

An implementation is available for review here.
https://github.com/ashley-taylor/avro/pull/2
This results in a large performance improvement as it removes auto-boxing and 
reflection overhead.

ReflectJavaRecordTest is equivalent to ReflectRecordTest, which uses just a 
Java Record.

Without generation
Benchmark                      Mode  Cnt         Score        Error  Units
ReflectRecordTest.decode  thrpt    3   5,338,482.675 ± 1,704,797.642  ops/s
ReflectRecordTest.encode  thrpt    3  11,780,932.736 ± 1,114,822.009  ops/s
ReflectJavaRecordTest.decode  thrpt    3   9,398,512.841 ± 722,648.301  ops/s
ReflectJavaRecordTest.encode  thrpt    3  15,403,641.548 ± 595,533.538  ops/s

With generation
Benchmark                      Mode  Cnt         Score          Error  Units
ReflectJavaRecordTest.decode  thrpt    3  18,923,631.295 ±  4,663,001.333  ops/s
ReflectJavaRecordTest.encode  thrpt    3  59,767,033.460 ± 19,338,720.141  ops/s



I understand that adding dynamic code generation is quite a significant change.
It currently requires a system property, but it would probably be better as a 
separate module that can be provided via SPI.

I am keen to see all the above work make the next minor release of Avro and am 
happy to help out where I can towards that release.

Ashley Taylor





Reply via email to