avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zoltan Farkas (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AVRO-1641) parser.java stack expansion probably not as intended
Date Thu, 19 Nov 2015 17:24:11 GMT

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

Zoltan Farkas commented on AVRO-1641:

Hi Sean, I am pretty sure the current code does not reflect the intent of the author...

I discovered this when reviewing the profiles of our benchmarks a while ago. I do not have
the perf measurements data anymore...
However the change I think is obvious, the current growth strategy makes no sense, huge allocation
which is overkill (outside of the TLAB) 99.9% of the time...

I will follow up with a patch... 
However it would be nice if we can be a bit more pragmatic in the future and reduce the contribution
overhead for simple/obvious things...

> parser.java stack expansion probably not as intended
> ----------------------------------------------------
>                 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
>            Priority: Minor
> 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):

>  private void expandStack() {
>     stack = Arrays.copyOf(stack, stack.length+Math.max(stack.length,1024));
>   }
> should probably be:
> private void expandStack() {
>     stack = Arrays.copyOf(stack, stack.length+Math.min(stack.length,1024));
>   }
> This expansion probably is intended to grow exponentially up to 1024, and not exponentially
after 1024...

This message was sent by Atlassian JIRA

View raw message