lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1439915 - in /lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene: index/NumericDocValuesWriter.java util/packed/AppendingLongBuffer.java
Date Tue, 29 Jan 2013 14:47:05 GMT
Author: rmuir
Date: Tue Jan 29 14:47:04 2013
New Revision: 1439915

URL: http://svn.apache.org/viewvc?rev=1439915&view=rev
Log:
remove n^2 ram accounting

Modified:
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesWriter.java
    lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/AppendingLongBuffer.java

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesWriter.java?rev=1439915&r1=1439914&r2=1439915&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesWriter.java
(original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesWriter.java
Tue Jan 29 14:47:04 2013
@@ -55,7 +55,7 @@ class NumericDocValuesWriter extends Doc
 
     pending.add(value);
 
-    updateBytesUsed(); // nocommit: O(n^2)!!!!!!!!!!!!
+    updateBytesUsed();
   }
 
   private void updateBytesUsed() {

Modified: lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/AppendingLongBuffer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/AppendingLongBuffer.java?rev=1439915&r1=1439914&r2=1439915&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/AppendingLongBuffer.java
(original)
+++ lucene/dev/branches/lucene4547/lucene/core/src/java/org/apache/lucene/util/packed/AppendingLongBuffer.java
Tue Jan 29 14:47:04 2013
@@ -33,6 +33,7 @@ public class AppendingLongBuffer {
 
   private long[] minValues;
   private PackedInts.Reader[] values;
+  private long valuesBytes;
   private int valuesOff;
   private long[] pending;
   private int pendingOff;
@@ -85,6 +86,7 @@ public class AppendingLongBuffer {
         i += mutable.set(i, pending, i, pendingOff - i);
       }
       values[valuesOff] = mutable;
+      valuesBytes += mutable.ramBytesUsed();
     }
     ++valuesOff;
 
@@ -166,12 +168,7 @@ public class AppendingLongBuffer {
         + RamUsageEstimator.sizeOf(minValues)
         + RamUsageEstimator.alignObjectSize(RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + (long)
RamUsageEstimator.NUM_BYTES_OBJECT_REF * values.length); // values
 
-    for (int i = 0; i < valuesOff; ++i) {
-      if (values[i] != null) {
-        bytesUsed += values[i].ramBytesUsed();
-      }
-    }
-    return bytesUsed;
+    return bytesUsed + valuesBytes;
   }
 
 }



Mime
View raw message