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

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

Gary Yao created FLINK-16940:
--------------------------------

             Summary: 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
             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)