diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-06-07 13:13:45 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2022-06-08 11:45:31 +0200 |
commit | 5fce9fedea4b8259d8d1bc1d26d47cc3b837b252 (patch) | |
tree | 5ae004ca96fa829088302972cbe33dd00c611a48 /config-model | |
parent | 40cf39429211d66616f8dce58198ecdfe43735eb (diff) |
Further GC document level compression. Avoids a buffer copy that is no longer relevant.
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java | 19 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java | 27 |
2 files changed, 32 insertions, 14 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java index dc10cf36244..e54ed1f1a8b 100644 --- a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java +++ b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java @@ -1,8 +1,15 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.configmodel.producers; +import com.yahoo.document.ArrayDataType; +import com.yahoo.document.DataType; +import com.yahoo.document.DocumentType; +import com.yahoo.document.MapDataType; +import com.yahoo.document.PrimitiveDataType; +import com.yahoo.document.StructDataType; +import com.yahoo.document.TensorDataType; +import com.yahoo.document.WeightedSetDataType; import com.yahoo.document.config.DocumentmanagerConfig; -import com.yahoo.document.*; import com.yahoo.document.annotation.AnnotationReferenceDataType; import com.yahoo.document.annotation.AnnotationType; import com.yahoo.documentmodel.NewDocumentReferenceDataType; @@ -68,9 +75,9 @@ public class DocumentManager { } static private class IdxMap { - private Map<Integer, Boolean> doneMap = new HashMap<>(); - private Map<String, Integer> map = new HashMap<>(); - private DataTypeRecognizer recognizer = new DataTypeRecognizer(); + private final Map<Integer, Boolean> doneMap = new HashMap<>(); + private final Map<String, Integer> map = new HashMap<>(); + private final DataTypeRecognizer recognizer = new DataTypeRecognizer(); private void add(String name) { // the adding of "10000" here is mostly to make it more @@ -111,8 +118,7 @@ public class DocumentManager { } static private <T> List<T> sortedList(Collection<T> unsorted, Comparator<T> cmp) { - var list = new ArrayList<T>(); - list.addAll(unsorted); + var list = new ArrayList<>(unsorted); list.sort(cmp); return list; } @@ -174,7 +180,6 @@ public class DocumentManager { builder.annotationtype(annBuilder); } - @SuppressWarnings("deprecation") private void docTypeBuildAnyType(DataType type, DocumentmanagerConfig.Doctype.Builder documentBuilder, IdxMap indexMap) { if (indexMap.isDone(type)) { return; diff --git a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java index b55eddd771d..549b94adc02 100644 --- a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java +++ b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java @@ -1,7 +1,14 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.configmodel.producers; -import com.yahoo.document.*; +import com.yahoo.document.ArrayDataType; +import com.yahoo.document.DataType; +import com.yahoo.document.DocumentType; +import com.yahoo.document.MapDataType; +import com.yahoo.document.PrimitiveDataType; +import com.yahoo.document.StructDataType; +import com.yahoo.document.TensorDataType; +import com.yahoo.document.WeightedSetDataType; import com.yahoo.document.config.DocumenttypesConfig; import com.yahoo.document.annotation.AnnotationReferenceDataType; import com.yahoo.document.annotation.AnnotationType; @@ -12,7 +19,15 @@ import com.yahoo.documentmodel.TemporaryUnknownType; import com.yahoo.documentmodel.VespaDocumentType; import com.yahoo.schema.document.FieldSet; import com.yahoo.vespa.documentmodel.DocumentModel; -import java.util.*; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.HashMap; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; /** * @author baldersheim @@ -37,8 +52,7 @@ public class DocumentTypes { } static private <T> List<T> sortedList(Collection<T> unsorted, Comparator<T> cmp) { - var list = new ArrayList<T>(); - list.addAll(unsorted); + var list = new ArrayList<>(unsorted); list.sort(cmp); return list; } @@ -58,8 +72,8 @@ public class DocumentTypes { } static private class IdxMap { - private Map<Integer, Boolean> doneMap = new HashMap<>(); - private Map<Object, Integer> map = new IdentityHashMap<>(); + private final Map<Integer, Boolean> doneMap = new HashMap<>(); + private final Map<Object, Integer> map = new IdentityHashMap<>(); void add(Object someType) { assert(someType != null); // the adding of "10000" here is mostly to make it more @@ -153,7 +167,6 @@ public class DocumentTypes { builder.annotationtype(annBuilder); } - @SuppressWarnings("deprecation") private void docTypeBuildAnyType(DataType type, DocumenttypesConfig.Doctype.Builder documentBuilder, IdxMap indexMap) { if (indexMap.isDone(type)) { return; |