mirror of https://github.com/apache/lucene.git
LUCENE-8475: Remove deprecated constants from RamUsageEstimator.
This commit is contained in:
parent
a9acdfdb54
commit
2da53c32cb
|
@ -73,6 +73,9 @@ API Changes
|
|||
methods from Scorer that should be called from Collectors. LeafCollector.setScorer()
|
||||
now takes a Scorable rather than a Scorer. (Alan Woodward, Adrien Grand)
|
||||
|
||||
* LUCENE-8475: Deprecated constants have been removed from RamUsageEstimator.
|
||||
(Dimitrios Athanasiou)
|
||||
|
||||
Changes in Runtime Behavior
|
||||
|
||||
* LUCENE-8333: Switch MoreLikeThis.setMaxDocFreqPct to use maxDoc instead of
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.apache.lucene.search.FieldComparator;
|
|||
import org.apache.lucene.search.LeafFieldComparator;
|
||||
import org.apache.lucene.search.Scorable;
|
||||
import org.apache.lucene.util.ArrayUtil;
|
||||
import org.apache.lucene.util.RamUsageEstimator;
|
||||
import org.apache.lucene.util.SloppyMath;
|
||||
|
||||
import static org.apache.lucene.geo.GeoEncodingUtils.decodeLatitude;
|
||||
|
@ -124,7 +123,7 @@ class LatLonPointDistanceComparator extends FieldComparator<Double> implements L
|
|||
valuesDocID = currentDocs.docID();
|
||||
int count = currentDocs.docValueCount();
|
||||
if (count > currentValues.length) {
|
||||
currentValues = new long[ArrayUtil.oversize(count, RamUsageEstimator.NUM_BYTES_LONG)];
|
||||
currentValues = new long[ArrayUtil.oversize(count, Long.BYTES)];
|
||||
}
|
||||
for(int i=0;i<count;i++) {
|
||||
currentValues[i] = currentDocs.nextValue();
|
||||
|
|
|
@ -55,56 +55,7 @@ public final class RamUsageEstimator {
|
|||
/** No instantiation. */
|
||||
private RamUsageEstimator() {}
|
||||
|
||||
/**
|
||||
* Number of bytes used to represent a {@code boolean} in binary form
|
||||
* @deprecated use {@code 1} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public final static int NUM_BYTES_BOOLEAN = 1;
|
||||
/**
|
||||
* Number of bytes used to represent a {@code byte} in binary form
|
||||
* @deprecated use {@code 1} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public final static int NUM_BYTES_BYTE = 1;
|
||||
/**
|
||||
* Number of bytes used to represent a {@code char} in binary form
|
||||
* @deprecated use {@link Character#BYTES} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public final static int NUM_BYTES_CHAR = Character.BYTES;
|
||||
/**
|
||||
* Number of bytes used to represent a {@code short} in binary form
|
||||
* @deprecated use {@link Short#BYTES} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public final static int NUM_BYTES_SHORT = Short.BYTES;
|
||||
/**
|
||||
* Number of bytes used to represent an {@code int} in binary form
|
||||
* @deprecated use {@link Integer#BYTES} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public final static int NUM_BYTES_INT = Integer.BYTES;
|
||||
/**
|
||||
* Number of bytes used to represent a {@code float} in binary form
|
||||
* @deprecated use {@link Float#BYTES} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public final static int NUM_BYTES_FLOAT = Float.BYTES;
|
||||
/**
|
||||
* Number of bytes used to represent a {@code long} in binary form
|
||||
* @deprecated use {@link Long#BYTES} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public final static int NUM_BYTES_LONG = Long.BYTES;
|
||||
/**
|
||||
* Number of bytes used to represent a {@code double} in binary form
|
||||
* @deprecated use {@link Double#BYTES} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public final static int NUM_BYTES_DOUBLE = Double.BYTES;
|
||||
|
||||
/**
|
||||
/**
|
||||
* True, iff compressed references (oops) are enabled by this JVM
|
||||
*/
|
||||
public final static boolean COMPRESSED_REFS_ENABLED;
|
||||
|
|
|
@ -62,7 +62,7 @@ final class Direct16 extends PackedInts.MutableImpl {
|
|||
public long ramBytesUsed() {
|
||||
return RamUsageEstimator.alignObjectSize(
|
||||
RamUsageEstimator.NUM_BYTES_OBJECT_HEADER
|
||||
+ 2 * RamUsageEstimator.NUM_BYTES_INT // valueCount,bitsPerValue
|
||||
+ 2 * Integer.BYTES // valueCount,bitsPerValue
|
||||
+ RamUsageEstimator.NUM_BYTES_OBJECT_REF) // values ref
|
||||
+ RamUsageEstimator.sizeOf(values);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ final class Direct32 extends PackedInts.MutableImpl {
|
|||
public long ramBytesUsed() {
|
||||
return RamUsageEstimator.alignObjectSize(
|
||||
RamUsageEstimator.NUM_BYTES_OBJECT_HEADER
|
||||
+ 2 * RamUsageEstimator.NUM_BYTES_INT // valueCount,bitsPerValue
|
||||
+ 2 * Integer.BYTES // valueCount,bitsPerValue
|
||||
+ RamUsageEstimator.NUM_BYTES_OBJECT_REF) // values ref
|
||||
+ RamUsageEstimator.sizeOf(values);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ final class Direct64 extends PackedInts.MutableImpl {
|
|||
public long ramBytesUsed() {
|
||||
return RamUsageEstimator.alignObjectSize(
|
||||
RamUsageEstimator.NUM_BYTES_OBJECT_HEADER
|
||||
+ 2 * RamUsageEstimator.NUM_BYTES_INT // valueCount,bitsPerValue
|
||||
+ 2 * Integer.BYTES // valueCount,bitsPerValue
|
||||
+ RamUsageEstimator.NUM_BYTES_OBJECT_REF) // values ref
|
||||
+ RamUsageEstimator.sizeOf(values);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ final class Direct8 extends PackedInts.MutableImpl {
|
|||
public long ramBytesUsed() {
|
||||
return RamUsageEstimator.alignObjectSize(
|
||||
RamUsageEstimator.NUM_BYTES_OBJECT_HEADER
|
||||
+ 2 * RamUsageEstimator.NUM_BYTES_INT // valueCount,bitsPerValue
|
||||
+ 2 * Integer.BYTES // valueCount,bitsPerValue
|
||||
+ RamUsageEstimator.NUM_BYTES_OBJECT_REF) // values ref
|
||||
+ RamUsageEstimator.sizeOf(values);
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ final class Packed16ThreeBlocks extends PackedInts.MutableImpl {
|
|||
public long ramBytesUsed() {
|
||||
return RamUsageEstimator.alignObjectSize(
|
||||
RamUsageEstimator.NUM_BYTES_OBJECT_HEADER
|
||||
+ 2 * RamUsageEstimator.NUM_BYTES_INT // valueCount,bitsPerValue
|
||||
+ 2 * Integer.BYTES // valueCount,bitsPerValue
|
||||
+ RamUsageEstimator.NUM_BYTES_OBJECT_REF) // blocks ref
|
||||
+ RamUsageEstimator.sizeOf(blocks);
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ abstract class Packed64SingleBlock extends PackedInts.MutableImpl {
|
|||
public long ramBytesUsed() {
|
||||
return RamUsageEstimator.alignObjectSize(
|
||||
RamUsageEstimator.NUM_BYTES_OBJECT_HEADER
|
||||
+ 2 * RamUsageEstimator.NUM_BYTES_INT // valueCount,bitsPerValue
|
||||
+ 2 * Integer.BYTES // valueCount,bitsPerValue
|
||||
+ RamUsageEstimator.NUM_BYTES_OBJECT_REF) // blocks ref
|
||||
+ RamUsageEstimator.sizeOf(blocks);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ final class Packed8ThreeBlocks extends PackedInts.MutableImpl {
|
|||
public long ramBytesUsed() {
|
||||
return RamUsageEstimator.alignObjectSize(
|
||||
RamUsageEstimator.NUM_BYTES_OBJECT_HEADER
|
||||
+ 2 * RamUsageEstimator.NUM_BYTES_INT // valueCount,bitsPerValue
|
||||
+ 2 * Integer.BYTES // valueCount,bitsPerValue
|
||||
+ RamUsageEstimator.NUM_BYTES_OBJECT_REF) // blocks ref
|
||||
+ RamUsageEstimator.sizeOf(blocks);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class DirectoryTaxonomyReader extends TaxonomyReader implements Accountab
|
|||
private static final int DEFAULT_CACHE_VALUE = 4000;
|
||||
|
||||
// NOTE: very coarse estimate!
|
||||
private static final int BYTES_PER_CACHE_ENTRY = 4 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 4 * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + 8 * RamUsageEstimator.NUM_BYTES_CHAR;
|
||||
private static final int BYTES_PER_CACHE_ENTRY = 4 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 4 * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + 8 * Character.BYTES;
|
||||
|
||||
private final DirectoryTaxonomyWriter taxoWriter;
|
||||
private final long taxoEpoch; // used in doOpenIfChanged
|
||||
|
|
|
@ -223,7 +223,7 @@ class TaxonomyIndexArrays extends ParallelTaxonomyArrays implements Accountable
|
|||
|
||||
@Override
|
||||
public synchronized long ramBytesUsed() {
|
||||
long ramBytesUsed = RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + 3 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + RamUsageEstimator.NUM_BYTES_BOOLEAN;
|
||||
long ramBytesUsed = RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + 3 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 1;
|
||||
ramBytesUsed += RamUsageEstimator.shallowSizeOf(parents);
|
||||
if (children != null) {
|
||||
ramBytesUsed += RamUsageEstimator.shallowSizeOf(children);
|
||||
|
|
Loading…
Reference in New Issue