cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject git commit: presize collections
Date Mon, 13 May 2013 22:37:15 GMT
Updated Branches:
  refs/heads/trunk 1aa55abb0 -> 1bd013983


presize collections


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1bd01398
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1bd01398
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1bd01398

Branch: refs/heads/trunk
Commit: 1bd0139836b99e171c465e312c9681a3e9fb96b3
Parents: 1aa55ab
Author: Dave Brosius <dbrosius@apache.org>
Authored: Mon May 13 18:35:54 2013 -0400
Committer: Dave Brosius <dbrosius@apache.org>
Committed: Mon May 13 18:35:54 2013 -0400

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/Table.java        |    2 +-
 .../db/compaction/AbstractCompactionStrategy.java  |    2 +-
 .../cassandra/db/index/SecondaryIndexManager.java  |    2 +-
 .../org/apache/cassandra/dht/BootStrapper.java     |    2 +-
 .../apache/cassandra/hadoop/BulkRecordWriter.java  |    2 +-
 .../cassandra/hadoop/ColumnFamilyRecordReader.java |    2 +-
 .../cassandra/io/util/MmappedSegmentedFile.java    |    3 ++-
 .../apache/cassandra/service/StorageService.java   |    2 +-
 8 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1bd01398/src/java/org/apache/cassandra/db/Table.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Table.java b/src/java/org/apache/cassandra/db/Table.java
index 32920e7..cd7d9b6 100644
--- a/src/java/org/apache/cassandra/db/Table.java
+++ b/src/java/org/apache/cassandra/db/Table.java
@@ -421,7 +421,7 @@ public class Table
 
     public List<Future<?>> flush()
     {
-        List<Future<?>> futures = new ArrayList<Future<?>>();
+        List<Future<?>> futures = new ArrayList<Future<?>>(columnFamilyStores.size());
         for (UUID cfId : columnFamilyStores.keySet())
             futures.add(columnFamilyStores.get(cfId).forceFlush());
         return futures;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1bd01398/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
index d719ad2..3db2469 100644
--- a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
+++ b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
@@ -260,7 +260,7 @@ public abstract class AbstractCompactionStrategy
             }
             // first, calculate estimated keys that do not overlap
             long keys = sstable.estimatedKeys();
-            Set<Range<Token>> ranges = new HashSet<Range<Token>>();
+            Set<Range<Token>> ranges = new HashSet<Range<Token>>(overlaps.size());
             for (SSTableReader overlap : overlaps)
                 ranges.add(new Range<Token>(overlap.first.token, overlap.last.token,
overlap.partitioner));
             long remainingKeys = keys - sstable.estimatedKeysForRanges(ranges);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1bd01398/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
index 0bf455a..af370d5 100644
--- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
+++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java
@@ -115,7 +115,7 @@ public class SecondaryIndexManager
 
     public Set<String> allIndexesNames()
     {
-        Set<String> names = new HashSet<String>();
+        Set<String> names = new HashSet<String>(indexesByColumn.size());
         for (SecondaryIndex index : indexesByColumn.values())
             names.add(index.getIndexName());
         return names;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1bd01398/src/java/org/apache/cassandra/dht/BootStrapper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/BootStrapper.java b/src/java/org/apache/cassandra/dht/BootStrapper.java
index f354b08..654a83f 100644
--- a/src/java/org/apache/cassandra/dht/BootStrapper.java
+++ b/src/java/org/apache/cassandra/dht/BootStrapper.java
@@ -89,7 +89,7 @@ public class BootStrapper
         if (initialTokens.size() > 0)
         {
             logger.debug("tokens manually specified as {}",  initialTokens);
-            List<Token> tokens = new ArrayList<Token>();
+            List<Token> tokens = new ArrayList<Token>(initialTokens.size());
             for (String tokenString : initialTokens)
             {
                 Token token = StorageService.getPartitioner().getTokenFactory().fromString(tokenString);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1bd01398/src/java/org/apache/cassandra/hadoop/BulkRecordWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hadoop/BulkRecordWriter.java b/src/java/org/apache/cassandra/hadoop/BulkRecordWriter.java
index 977a600..de6d2e0 100644
--- a/src/java/org/apache/cassandra/hadoop/BulkRecordWriter.java
+++ b/src/java/org/apache/cassandra/hadoop/BulkRecordWriter.java
@@ -316,7 +316,7 @@ implements org.apache.hadoop.mapred.RecordWriter<ByteBuffer,List<Mutation>>
 
                     for (KsDef ksDef : ksDefs)
                     {
-                        Set<String> cfs = new HashSet<String>();
+                        Set<String> cfs = new HashSet<String>(ksDef.cf_defs.size());
                         for (CfDef cfDef : ksDef.cf_defs)
                             cfs.add(cfDef.name);
                         knownCfs.put(ksDef.name, cfs);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1bd01398/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
index 412e57d..3d4d591 100644
--- a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
+++ b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
@@ -252,7 +252,7 @@ public class ColumnFamilyRecordReader extends RecordReader<ByteBuffer,
SortedMap
                 // Get the Keyspace metadata, then get the specific CF metadata
                 // in order to populate the sub/comparator.
                 KsDef ks_def = client.describe_keyspace(keyspace);
-                List<String> cfnames = new ArrayList<String>();
+                List<String> cfnames = new ArrayList<String>(ks_def.cf_defs.size());
                 for (CfDef cfd : ks_def.cf_defs)
                     cfnames.add(cfd.name);
                 int idx = cfnames.indexOf(cfName);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1bd01398/src/java/org/apache/cassandra/io/util/MmappedSegmentedFile.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/util/MmappedSegmentedFile.java b/src/java/org/apache/cassandra/io/util/MmappedSegmentedFile.java
index a978c19..cf20f8f 100644
--- a/src/java/org/apache/cassandra/io/util/MmappedSegmentedFile.java
+++ b/src/java/org/apache/cassandra/io/util/MmappedSegmentedFile.java
@@ -219,9 +219,10 @@ public class MmappedSegmentedFile extends SegmentedFile
         public void deserializeBounds(DataInput in) throws IOException
         {
             super.deserializeBounds(in);
-            List<Long> temp = new ArrayList<Long>();
 
             int size = in.readInt();
+            List<Long> temp = new ArrayList<Long>(size);
+            
             for (int i = 0; i < size; i++)
                 temp.add(in.readLong());
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1bd01398/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index 2ae2e6d..7b047da 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -669,7 +669,7 @@ public class StorageService extends NotificationBroadcasterSupport implements
IE
                 }
                 else
                 {
-                    tokens = new ArrayList<Token>();
+                    tokens = new ArrayList<Token>(initialTokens.size());
                     for (String token : initialTokens)
                         tokens.add(getPartitioner().getTokenFactory().fromString(token));
                     logger.info("Saved token not found. Using " + tokens + " from configuration");


Mime
View raw message