Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-9999

Improve usage of HashMap and HashSet in NetworkTopologyStrategy

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Low
    • Resolution: Won't Fix
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Attachments

        1. 9999.txt
          3 kB
          Tommy Stendahl

          Issue Links

            Activity

              People

              • Assignee:
                tommy_s Tommy Stendahl
                Reporter:
                tommy_s Tommy Stendahl
                Authors:
                Tommy Stendahl
                Reviewers:
                Branimir Lambov
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: