mirror of https://github.com/apache/lucene.git
remove n^2 ram accounting
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1439915 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6bfac8590b
commit
fa35092734
|
@ -55,7 +55,7 @@ class NumericDocValuesWriter extends DocValuesWriter {
|
|||
|
||||
pending.add(value);
|
||||
|
||||
updateBytesUsed(); // nocommit: O(n^2)!!!!!!!!!!!!
|
||||
updateBytesUsed();
|
||||
}
|
||||
|
||||
private void updateBytesUsed() {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue