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

Doug Cutting commented on AVRO-753:
-----------------------------------

Looks good, passes tests.  A few questions:
 - Should we provide a 'public static EncoderFactory get()' method that returns 
an immutable factory?  There's lot of 'new EncoderFactory().binaryEncoder();' 
and 'private static final EncoderFactor FACTORY = new EncoderFactory();' 
sprinkled in the code that might use this instead.
 - Should the 'protected final' BinaryEncoder methods perhaps be made 'public 
static'?  They might even live on BinaryData instead, as a common place for 
such static utility methods related to the binary encoding.  I don't feel too 
strongly about this, but it seems like these highly optimized routines might 
also be useful in other contexts.
 - Why does BlockingBinaryEncoder override BufferedBinaryEncoder methods with 
identical implementations, e.g., writeBoolean(), writeInt(), writeFloat()?  Is 
this intentional, accidental or did I miss something?

> Java:  Improve BinaryEncoder Performance
> ----------------------------------------
>
>                 Key: AVRO-753
>                 URL: https://issues.apache.org/jira/browse/AVRO-753
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Scott Carey
>            Assignee: Scott Carey
>             Fix For: 1.5.0
>
>         Attachments: AVRO-753.v1.patch, AVRO-753.v2.patch, AVRO-753.v3.patch
>
>
> BinaryEncoder has not had a performance improvement pass like BinaryDecoder 
> did.  It still mostly writes directly to the underlying OutputStream which is 
> not optimal for performance.  I like to use a rule that if you are writing to 
> an OutputStream or reading from an InputStream in chunks smaller than 128 
> bytes, you have a performance problem.
> Measurements indicate that optimizing BinaryEncoder yields a 2.5x to 6x 
> performance improvement.  The process is significantly simpler than 
> BinaryDecoder because 'pushing' is easier than 'pulling' -- and also because 
> we do not need a 'direct' variant because BinaryEncoder already buffers 
> sometimes.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to