avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Cutting (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1607) Minor performance enhancement
Date Tue, 16 Dec 2014 18:58:14 GMT

    [ https://issues.apache.org/jira/browse/AVRO-1607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14248685#comment-14248685
] 

Doug Cutting commented on AVRO-1607:
------------------------------------

Can you please create a benchmark that shows this optimization is significant?  Ideally this
would be added to Perf.java.

> Minor performance enhancement
> -----------------------------
>
>                 Key: AVRO-1607
>                 URL: https://issues.apache.org/jira/browse/AVRO-1607
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.8.0
>            Reporter: Zoltan Farkas
>            Priority: Minor
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> In SpecificData.getClass, line 164:
>     case UNION:
>       List<Schema> types = schema.getTypes();     // elide unions with null
>       if ((types.size() == 2) && types.contains(NULL_SCHEMA))
>         return getWrapper(types.get(types.get(0).equals(NULL_SCHEMA) ? 1 : 0));
>       return Object.class;
> can be written more efficiently as:
>     case UNION:
>       List<Schema> types = schema.getTypes();     // elide unions with null
>       if ((types.size() == 2)) {
>         if (NULL_SCHEMA.equals(types.get(0))) {
>           return getWrapper(types.get(1));
>         } else if (NULL_SCHEMA.equals(types.get(1))) {
>            return getWrapper(types.get(0));
>         }
>       }
>       return Object.class;



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message