Avro
  1. Avro
  2. AVRO-316

Optiminzing inner loop functions of Avro io

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.0
    • Component/s: java
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      The methods advance() and pushProduction() of org.apache.avro.io.parsing.Parser class are invoked at least once per read/write call on ValidatingDecoder, ResolvingDecoder and ValidatingEncoder. Any optimization in these functions will improve overall performance when using these classes.

      Try org.apacge.avro.io.Perf -V to see the effect of this patch on the performance. On my machine it gives about 5 to 8% improvement.

      The optimizations are:

      • Reorder the code within advance() so that the most frequent paths involve minimal comparisons.
      • Repleace Symbol.CONTINUE with null to indicate that next symbol on the stack needs to be looked at.
      • Get rid of a parameter to pushProduction. This parameter was used only in one call site of that function; others pass null. Refactored the code so that these invocations do not pay for that piece of logic that they don't use.
      1. AVRO-316.patch
        10 kB
        Thiruvalluvan M. G.
      2. AVRO-316-test.patch
        7 kB
        Thiruvalluvan M. G.

        Activity

        Hide
        Thiruvalluvan M. G. added a comment -

        Committed revision 899720. Fixed the documentation comment.

        Show
        Thiruvalluvan M. G. added a comment - Committed revision 899720. Fixed the documentation comment.
        Hide
        Doug Cutting added a comment -

        This commit creates a javadoc warning:

        [javadoc] src/java/org/apache/avro/io/parsing/Parser.java:129: warning - @param argument "input" is not a parameter name.

        This causes 'ant clean test-java' to fail.

        Reverting, since this also depends on AVRO-313, which breaks tests in a more substantial way.

        Show
        Doug Cutting added a comment - This commit creates a javadoc warning: [javadoc] src/java/org/apache/avro/io/parsing/Parser.java:129: warning - @param argument "input" is not a parameter name. This causes 'ant clean test-java' to fail. Reverting, since this also depends on AVRO-313 , which breaks tests in a more substantial way.
        Hide
        Thiruvalluvan M. G. added a comment -

        Committed revision 899195.

        Show
        Thiruvalluvan M. G. added a comment - Committed revision 899195.
        Hide
        Doug Cutting added a comment -

        +1 These changes look good to me.

        Show
        Doug Cutting added a comment - +1 These changes look good to me.

          People

          • Assignee:
            Thiruvalluvan M. G.
            Reporter:
            Thiruvalluvan M. G.
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development