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

Zoltan Farkas commented on AVRO-1641:
-------------------------------------

I actually changed the logic in my fork as follows:

this.stack = new Symbol[10]; 

+

growth strategy similar to java.util.ArrayList. see:

https://github.com/zolyfarkas/avro/blob/trunk/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Parser.java#L65

In any case the initial size of 5 is too small and results in lots of 
expansions... The currently expansion logic implementation is inefficient, so I 
completely redone it in my fork.



> parser.java stack should expand quickly up to some threshold rather than 
> start at the threshold
> -----------------------------------------------------------------------------------------------
>
>                 Key: AVRO-1641
>                 URL: https://issues.apache.org/jira/browse/AVRO-1641
>             Project: Avro
>          Issue Type: Bug
>    Affects Versions: 1.7.7, 1.8.0
>            Reporter: Zoltan Farkas
>            Assignee: Zoltan Farkas
>            Priority: Minor
>         Attachments: AVRO-1641.patch
>
>
> at Parser.java line 65 
> (https://github.com/apache/avro/blob/trunk/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Parser.java#L65):
>  
> {noformat}
>  private void expandStack() {
>     stack = Arrays.copyOf(stack, stack.length+Math.max(stack.length,1024));
>   }
> {noformat}
> should probably be:
> {noformat}
> private void expandStack() {
>     stack = Arrays.copyOf(stack, stack.length+Math.min(stack.length,1024));
>   }
> {noformat}
> This expansion probably is intended to grow exponentially up to 1024, and not 
> exponentially after 1024...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to