You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Zezeng Wang (Jira)" <ji...@apache.org> on 2020/03/30 12:45:00 UTC
[jira] [Updated] (AVRO-2786) Initialize the buffer area for
StringBuilder/List
[ https://issues.apache.org/jira/browse/AVRO-2786?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Zezeng Wang updated AVRO-2786:
------------------------------
Description:
Under the StringBuilder/List is a char array to store. If the internal buffer overflows (the default length is 16/10), it will automatically become larger. A new internal buffer will be allocated to the array copy. Although it cannot be completely avoided, it can reduce the expansion It's not bad.
E.g:
[https://github.com/apache/avro/blob/87aefa28ad6cb11ab95010cdeac2223cfb701c0d/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L964]
[https://github.com/apache/avro/blob/87aefa28ad6cb11ab95010cdeac2223cfb701c0d/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L944]
{code:java}
final List<?> list = (List<?>) value;
final List<String> annots = new ArrayList<>(); //-----init
for(Object o : list){
annots.add(o.toString());
}
was:
Under the StringBuilder/List is a char array to store. If the internal buffer overflows (the default length is 16/10), it will automatically become larger. A new internal buffer will be allocated to the array copy. Although it cannot be completely avoided, it can reduce the expansion It's not bad.
E.g:
[https://github.com/apache/avro/blob/87aefa28ad6cb11ab95010cdeac2223cfb701c0d/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L964]
[https://github.com/apache/avro/blob/87aefa28ad6cb11ab95010cdeac2223cfb701c0d/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L944]
```
final List<?> list = (List<?>) value;
final List<String> annots = new ArrayList<>(); //-----init
for(Object o : list){
annots.add(o.toString());
}
```
> Initialize the buffer area for StringBuilder/List
> -------------------------------------------------
>
> Key: AVRO-2786
> URL: https://issues.apache.org/jira/browse/AVRO-2786
> Project: Apache Avro
> Issue Type: Wish
> Components: java
> Reporter: Zezeng Wang
> Priority: Minor
>
> Under the StringBuilder/List is a char array to store. If the internal buffer overflows (the default length is 16/10), it will automatically become larger. A new internal buffer will be allocated to the array copy. Although it cannot be completely avoided, it can reduce the expansion It's not bad.
> E.g:
> [https://github.com/apache/avro/blob/87aefa28ad6cb11ab95010cdeac2223cfb701c0d/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L964]
> [https://github.com/apache/avro/blob/87aefa28ad6cb11ab95010cdeac2223cfb701c0d/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L944]
> {code:java}
> final List<?> list = (List<?>) value;
> final List<String> annots = new ArrayList<>(); //-----init
> for(Object o : list){
> annots.add(o.toString());
> }
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)