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

Scott Carey commented on AVRO-911:
----------------------------------

For a record that is filled with primitives, re-use is also valuable.  There 
are a few cases where it does not work so well:
Unions
string/bytes
Maps

In the above cases either it is difficult or unlikely for reuse to be effective 
(Unions, Maps) or re-use has small benefit and causes unexpected behavior 
(String, Bytes)

What about the following simplification:

* Utf8 is not re-used.  (we may be able to re-use the empty string with itself, 
or make Utf8 immutable and re-use equivalent copies, but that is not in scope 
here)
* byte arrays are not re-used
* maps are not re-used

Arrays and Records, where the biggest gain of re-use is possible, remains.


                
> remove object reuse from Java APIs
> ----------------------------------
>
>                 Key: AVRO-911
>                 URL: https://issues.apache.org/jira/browse/AVRO-911
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Doug Cutting
>            Assignee: Doug Cutting
>             Fix For: 1.6.0
>
>         Attachments: perf-reuse.patch
>
>
> Avro's Java APIs were designed to permit object reuse when reading with the 
> assumption that would provide performance advantages.  In particular, the old 
> parameter in DatumReader<T>.read(T old, Decoder), the Utf8 class, and the 
> GenericArray.peek() method were all designed for this purpose.  But I am 
> unable to see significant performance improvements when objects are reused.  
> I tried modifying Perf.java's GenericTest to reuse records, and its 
> StringTest to not reuse Utf8 instances and, in both cases, performance is not 
> substantially altered.
> If we were to remove these then issues such as AVRO-803 would disappear.  
> Always using java.lang.String instead of Utf8 would remove a lot of user 
> confusion. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to