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

Scott Carey commented on AVRO-557:
----------------------------------

DecoderFactory.createBinaryDecoder(byte[], int, int, BinaryDecoder)
uses the given byte[] AS the buffer, so it is the most optimal.

DecoderFactory.createBinaryDecoder(InputStream, BinaryDecoder)
uses the internal read buffer of size binaryDecoderBufferSize, filling it from 
the InputStream.   If a user must interleave reads on the given InputStream 
between some other code and the BinaryDecoder they must either have that other 
code use the InputStream from BinaryDecoder.inputStream() to compensate for the 
'read-ahead' that the buffering causes, or use the slower DirectBinaryDecoder 
which only takes the absolute minimum number of bytes from the InputStream.

Note that, even if configured to use the DirectBinaryDecoder, it will only do 
so if a user is attempting to use a factory method that reads from an input 
stream.  If reading from a byte[] it always uses the more optimal 
BinaryDecoder. 

> Speed up one-time data decoding
> -------------------------------
>
>                 Key: AVRO-557
>                 URL: https://issues.apache.org/jira/browse/AVRO-557
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.3.2
>            Reporter: Kevin Oliver
>            Assignee: Kevin Oliver
>             Fix For: 1.4.0
>
>         Attachments: AVRO-557.patch
>
>
> There are big gains to be had in performance when using a BinaryDecoder and a 
> GenericDatumReader just one time. This is due to the relatively expensive 
> parsing and initialization that came with 1.3. Patch with example code and a 
> Perf harness to follow.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to