lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cpoersc...@apache.org
Subject svn commit: r1713903 - in /lucene/dev/trunk/lucene: ./ core/src/java/org/apache/lucene/index/
Date Wed, 11 Nov 2015 17:52:01 GMT
Author: cpoerschke
Date: Wed Nov 11 17:52:00 2015
New Revision: 1713903

URL: http://svn.apache.org/viewvc?rev=1713903&view=rev
Log:
LUCENE-6892: various lucene.index initialCapacity tweaks

Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/CodecReader.java
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/LogMergePolicy.java
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/MultiFields.java
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/SegmentDocValuesProducer.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1713903&r1=1713902&r2=1713903&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Wed Nov 11 17:52:00 2015
@@ -203,6 +203,9 @@ Optimizations
 * LUCENE-6863: Optimized storage requirements of doc values fields when less
   than 1% of documents have a value. (Adrien Grand)
 
+* LUCENE-6892: various lucene.index initialCapacity tweaks
+  (Christine Poerschke)
+
 Bug Fixes
 
 * LUCENE-6817: ComplexPhraseQueryParser.ComplexPhraseQuery does not display 

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/CodecReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/CodecReader.java?rev=1713903&r1=1713902&r2=1713903&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/CodecReader.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/CodecReader.java Wed Nov
11 17:52:00 2015
@@ -333,7 +333,7 @@ public abstract class CodecReader extend
   @Override
   public Collection<Accountable> getChildResources() {
     ensureOpen();
-    List<Accountable> resources = new ArrayList<>();
+    final List<Accountable> resources = new ArrayList<>(6);
     
     // terms/postings
     resources.add(Accountables.namedAccountable("postings", getPostingsReader()));

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java?rev=1713903&r1=1713902&r2=1713903&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java Wed Nov
11 17:52:00 2015
@@ -2390,7 +2390,7 @@ public class IndexWriter implements Clos
    *  to match with a call to {@link IOUtils#close} in a
    *  finally clause. */
   private List<Lock> acquireWriteLocks(Directory... dirs) throws IOException {
-    List<Lock> locks = new ArrayList<>();
+    List<Lock> locks = new ArrayList<>(dirs.length);
     for(int i=0;i<dirs.length;i++) {
       boolean success = false;
       try {
@@ -3967,7 +3967,7 @@ public class IndexWriter implements Clos
       infoStream.message("IW", "merging " + segString(merge.segments));
     }
 
-    merge.readers = new ArrayList<>();
+    merge.readers = new ArrayList<>(sourceSegments.size());
 
     // This is try/finally to make sure merger's readers are
     // closed:

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/LogMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/LogMergePolicy.java?rev=1713903&r1=1713902&r2=1713903&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/LogMergePolicy.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/LogMergePolicy.java Wed
Nov 11 17:52:00 2015
@@ -461,7 +461,7 @@ public abstract class LogMergePolicy ext
 
     // Compute levels, which is just log (base mergeFactor)
     // of the size of each segment
-    final List<SegmentInfoAndLevel> levels = new ArrayList<>();
+    final List<SegmentInfoAndLevel> levels = new ArrayList<>(numSegments);
     final float norm = (float) Math.log(mergeFactor);
 
     final Collection<SegmentCommitInfo> mergingSegments = writer.getMergingSegments();
@@ -563,7 +563,7 @@ public abstract class LogMergePolicy ext
         } else if (!anyTooLarge) {
           if (spec == null)
             spec = new MergeSpecification();
-          final List<SegmentCommitInfo> mergeInfos = new ArrayList<>();
+          final List<SegmentCommitInfo> mergeInfos = new ArrayList<>(end-start);
           for(int i=start;i<end;i++) {
             mergeInfos.add(levels.get(i).info);
             assert infos.contains(levels.get(i).info);

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/MultiFields.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/MultiFields.java?rev=1713903&r1=1713902&r2=1713903&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/MultiFields.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/MultiFields.java Wed Nov
11 17:52:00 2015
@@ -66,8 +66,8 @@ public final class MultiFields extends F
         // already an atomic reader / reader with one leave
         return leaves.get(0).reader().fields();
       default:
-        final List<Fields> fields = new ArrayList<>();
-        final List<ReaderSlice> slices = new ArrayList<>();
+        final List<Fields> fields = new ArrayList<>(leaves.size());
+        final List<ReaderSlice> slices = new ArrayList<>(leaves.size());
         for (final LeafReaderContext ctx : leaves) {
           final LeafReader r = ctx.reader();
           final Fields f = r.fields();

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/SegmentDocValuesProducer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/SegmentDocValuesProducer.java?rev=1713903&r1=1713902&r2=1713903&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/SegmentDocValuesProducer.java
(original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/SegmentDocValuesProducer.java
Wed Nov 11 17:52:00 2015
@@ -161,7 +161,7 @@ class SegmentDocValuesProducer extends D
 
   @Override
   public Collection<Accountable> getChildResources() {
-    List<Accountable> resources = new ArrayList<>();
+    final List<Accountable> resources = new ArrayList<>(dvProducers.size());
     for (Accountable producer : dvProducers) {
       resources.add(Accountables.namedAccountable("delegate", producer));
     }



Mime
View raw message