Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D18A418C1C for ; Thu, 6 Aug 2015 11:18:04 +0000 (UTC) Received: (qmail 33689 invoked by uid 500); 6 Aug 2015 11:18:04 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 33656 invoked by uid 500); 6 Aug 2015 11:18:04 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 33643 invoked by uid 99); 6 Aug 2015 11:18:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Aug 2015 11:18:04 +0000 Date: Thu, 6 Aug 2015 11:18:04 +0000 (UTC) From: "Tommy Stendahl (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CASSANDRA-9999) Improve usage of HashMap and HashSet in NetworkTopologyStrategy MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Tommy Stendahl created CASSANDRA-9999: ----------------------------------------- Summary: Improve usage of HashMap and HashSet in NetworkTopologyStrategy Key: CASSANDRA-9999 URL: https://issues.apache.org/jira/browse/CASSANDRA-9999 Project: Cassandra Issue Type: Improvement Reporter: Tommy Stendahl Assignee: Tommy Stendahl Priority: Minor 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)