[
https://issues.apache.org/jira/browse/AVRO-3643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17620085#comment-17620085
]
Christophe Le Saec commented on AVRO-3643:
------------------------------------------
Hello,
I think we can improve [GenericData.resolveUnion
method|https://github.com/clesaec/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java#L876-L890]
(for first part); by using Map.containsKey and get conversions Map only if
needed.
I'm going to build a branch with this kind of change. Could you then tell me if
it make real improve or just too small ?
> GenericDatumWriter Potential Performance improvement
> ----------------------------------------------------
>
> Key: AVRO-3643
> URL: https://issues.apache.org/jira/browse/AVRO-3643
> Project: Apache Avro
> Issue Type: Improvement
> Components: java
> Affects Versions: 1.11.1
> Reporter: Paul Anderson
> Priority: Minor
> Attachments: image-2022-10-18-17-38-44-273.png
>
>
> Sorry for the seemingly naïve nature of this observation, however whilst
> trying to resolve a Kafka client performance issue on Mainframe I noticed a
> potential opportunity in Avro serialisation. I am using a compiled Avro
> schema and noticed with my special profiling tool (see attached image) that
> writeWithoutConversion calls resolveUnion which performs three HashMap.get's.
> Seeing this a compiled serialiser is there not an opportunity to eliminate
> these calls which would reduce the Record serialisation cost to something
> closer the absolute minimum .writeString (.writePrimitive).
>
> !image-2022-10-18-17-38-44-273.png!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)