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

Leo Romanoff commented on AVRO-1277:
------------------------------------

@Doug: 
1) If I add a test to Perf.java, I cannot directly compare it to the 
unoptimized reflection-based approach, as I changed it, or? Of course, one can 
try then this Perf test with the old and with the new patched version and 
compare results. Is it what you mean?

2) I'm not sure I can move Accessor check to the start, as it currently happens 
after the array object is created. And at the start of the method I don't have 
the array object yet. More over, if I'd call super.readArray() it would create 
this array on its own. But may be there is a way to check the type of array 
elements without creating it?

3) Done :-)

@Holger: Yes, there is a potential for leaks. But quick grep on Avro sources 
shows that it is not the only use of ThreadLocal. In addition to what Doug 
said, I can also think of caches which clean-up themselves after a certain 
timeout or period of inactivity. 
                
> Improve performance of reflection-based serializers
> ---------------------------------------------------
>
>                 Key: AVRO-1277
>                 URL: https://issues.apache.org/jira/browse/AVRO-1277
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.7.4
>            Reporter: Leo Romanoff
>            Priority: Minor
>         Attachments: AVRO-1277.patch
>
>
> I've played a bit with Avro serialization based on reflection, i.e. with the 
> classes from org.apache.avro.generic package.
> It works fine in this mode, but is rather slow compared to such frameworks 
> like protostuff or kryo.
> Quick look at the source code has shown that a lot of reflection-based 
> operations and class lookups are not cached. And such operations are usually 
> pretty expensive when executed by a JVM. 
> So I changed some of org.apache.avro.generic classes, introduced caching and 
> a few other optimizations. Now it seems to perform much better.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to