You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2015/03/02 14:47:03 UTC
svn commit: r1663302 - in /lucene/dev/branches/branch_5x: ./ lucene/
lucene/CHANGES.txt lucene/core/
lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50FieldInfosFormat.java
Author: rmuir
Date: Mon Mar 2 13:47:02 2015
New Revision: 1663302
URL: http://svn.apache.org/r1663302
Log:
LUCENE-6318: re-use immutable maps across fieldinfos when they are the same
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/lucene/ (props changed)
lucene/dev/branches/branch_5x/lucene/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_5x/lucene/core/ (props changed)
lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50FieldInfosFormat.java
Modified: lucene/dev/branches/branch_5x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/CHANGES.txt?rev=1663302&r1=1663301&r2=1663302&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/lucene/CHANGES.txt Mon Mar 2 13:47:02 2015
@@ -96,6 +96,9 @@ Optimizations
rewrites to a BooleanQuery when the filter is a QueryWrapperFilter in order
to leverage approximations. (Adrien Grand)
+* LUCENE-6318: Reduce RAM usage of FieldInfos when there are many fields.
+ (Mike McCandless, Robert Muir)
+
API Changes
* LUCENE-6204, LUCENE-6208: Simplify CompoundFormat: remove files()
Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50FieldInfosFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50FieldInfosFormat.java?rev=1663302&r1=1663301&r2=1663302&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50FieldInfosFormat.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50FieldInfosFormat.java Mon Mar 2 13:47:02 2015
@@ -120,6 +120,9 @@ public final class Lucene50FieldInfosFor
final int size = input.readVInt(); //read in the size
infos = new FieldInfo[size];
+ // previous field's attribute map, we share when possible:
+ Map<String,String> lastAttributes = Collections.emptyMap();
+
for (int i = 0; i < size; i++) {
String name = input.readString();
final int fieldNumber = input.readVInt();
@@ -136,12 +139,17 @@ public final class Lucene50FieldInfosFor
// DV Types are packed in one byte
final DocValuesType docValuesType = getDocValuesType(input, input.readByte());
final long dvGen = input.readLong();
- final Map<String,String> attributes;
+ Map<String,String> attributes;
if (format >= FORMAT_SAFE_MAPS) {
attributes = input.readMapOfStrings();
} else {
attributes = Collections.unmodifiableMap(input.readStringStringMap());
}
+ // just use the last field's map if its the same
+ if (attributes.equals(lastAttributes)) {
+ attributes = lastAttributes;
+ }
+ lastAttributes = attributes;
try {
infos[i] = new FieldInfo(name, fieldNumber, storeTermVector, omitNorms, storePayloads,
indexOptions, docValuesType, dvGen, attributes);