You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/04/02 08:36:00 UTC

[jira] [Updated] (FLINK-16940) Avoid creating currentRegion HashSet with manually set initialCapacity

     [ https://issues.apache.org/jira/browse/FLINK-16940?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated FLINK-16940:
-----------------------------------
    Labels: pull-request-available  (was: )

> Avoid creating currentRegion HashSet with manually set initialCapacity
> ----------------------------------------------------------------------
>
>                 Key: FLINK-16940
>                 URL: https://issues.apache.org/jira/browse/FLINK-16940
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / REST
>    Affects Versions: 1.11.0
>            Reporter: Gary Yao
>            Assignee: Gary Yao
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.11.0
>
>
> The {{currentRegion}} HashSet in {{PipelinedRegionComputeUtil}} is created with an initialCapacity of 1. This is wrong because when we add the first element, the sets capacity will be already increased. From the style guidelines:
> {quote}
> Set the initial capacity for a collection only if there is a good proven reason for that, otherwise do not clutter the code. In case of Maps it can be even deluding because the Map’s load factor effectively reduces the capacity.
> {quote}
> https://flink.apache.org/contributing/code-style-and-quality-java.html



--
This message was sent by Atlassian Jira
(v8.3.4#803005)