[jira] [Commented] (CASSANDRA-9999) Improve usage of HashMap and HashSet in NetworkTopologyStrategy
[ https://issues.apache.org/jira/browse/CASSANDRA-?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15101418#comment-15101418 ] Branimir Lambov commented on CASSANDRA-: The patch is fine, but it's made obsolete by CASSANDRA-10200 for 3.2+. Is this needed for 2.x? > Improve usage of HashMap and HashSet in NetworkTopologyStrategy > --- > > Key: CASSANDRA- > URL: https://issues.apache.org/jira/browse/CASSANDRA- > Project: Cassandra > Issue Type: Improvement >Reporter: Tommy Stendahl >Assignee: Tommy Stendahl >Priority: Minor > Attachments: .txt > > > In NetworkTopologyStrategy there are HashMaps and HashSets created with a > specified initial size. I assume that this is done avoid having them re sized > then when objects are inserted to them. Unfortunately they are created with > the size of the expected number of object that will be inserted into them. > Since the default load factor is 0.75 this will almost guarantee that > HashMaps and HashSets are re sized, to avoid re size the initial size should > be set to "no of objects / 0.75 +1". > Since this is done every time calculateNaturalEndpoints() is called this > might have some performance impact. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CASSANDRA-9999) Improve usage of HashMap and HashSet in NetworkTopologyStrategy
[ https://issues.apache.org/jira/browse/CASSANDRA-?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14661908#comment-14661908 ] Tommy Stendahl commented on CASSANDRA-: --- I have attached a patch that changes how the initial size of the HashMaps and HashSets are calculated. It should merge to all branches without conflict. Improve usage of HashMap and HashSet in NetworkTopologyStrategy --- Key: CASSANDRA- URL: https://issues.apache.org/jira/browse/CASSANDRA- Project: Cassandra Issue Type: Improvement Reporter: Tommy Stendahl Assignee: Tommy Stendahl Priority: Minor Attachments: .txt In NetworkTopologyStrategy there are HashMaps and HashSets created with a specified initial size. I assume that this is done avoid having them re sized then when objects are inserted to them. Unfortunately they are created with the size of the expected number of object that will be inserted into them. Since the default load factor is 0.75 this will almost guarantee that HashMaps and HashSets are re sized, to avoid re size the initial size should be set to no of objects / 0.75 +1. Since this is done every time calculateNaturalEndpoints() is called this might have some performance impact. -- This message was sent by Atlassian JIRA (v6.3.4#6332)