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

Scott Carey commented on AVRO-753:
----------------------------------

* EncoderFactory.get() :  This would mirror what we have in DecoderFactory, and 
I had something similar in in a previous version.  I'll add it back and see how 
much that cleans up other code.
* I'll move them.  BinaryData is a good home for these, and already has a 
similar 'skipLong' method.  Making them a public part of the API makes sense 
too.
* Those methods are not quite equal, ensureBounds() is private in each 
implementation, and tends to a different buffer.  It can't be made protected, 
since both have to exist at the same time to manage both buffers.  Another way 
to state it is that ensureBounds() is an implementation detail, named the same 
thing in the two classes and similar in function, but not polymorphic.

I'll put together a patch with changes later today.

> 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
>            Priority: Blocker
>             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