lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject lucene-solr:master: SOLR-10026: JavaBinCodec should initialize maps and namedLists with known capacity
Date Tue, 24 Jan 2017 20:38:35 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master ca50e5b61 -> 9899cbd03


SOLR-10026: JavaBinCodec should initialize maps and namedLists with known capacity


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/9899cbd0
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/9899cbd0
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/9899cbd0

Branch: refs/heads/master
Commit: 9899cbd031dc3fc37a384b1f9e2b379e90a9a3a6
Parents: ca50e5b
Author: Noble Paul <noble@apache.org>
Authored: Wed Jan 25 07:08:25 2017 +1030
Committer: Noble Paul <noble@apache.org>
Committed: Wed Jan 25 07:08:25 2017 +1030

----------------------------------------------------------------------
 .../java/org/apache/solr/common/util/JavaBinCodec.java    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9899cbd0/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
index 3e054d7..7e0cac6 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/JavaBinCodec.java
@@ -189,7 +189,7 @@ public class JavaBinCodec implements PushWriter {
 
   public SimpleOrderedMap<Object> readOrderedMap(DataInputInputStream dis) throws IOException
{
     int sz = readSize(dis);
-    SimpleOrderedMap<Object> nl = new SimpleOrderedMap<>();
+    SimpleOrderedMap<Object> nl = new SimpleOrderedMap<>(sz);
     for (int i = 0; i < sz; i++) {
       String name = (String) readVal(dis);
       Object val = readVal(dis);
@@ -200,7 +200,7 @@ public class JavaBinCodec implements PushWriter {
 
   public NamedList<Object> readNamedList(DataInputInputStream dis) throws IOException
{
     int sz = readSize(dis);
-    NamedList<Object> nl = new NamedList<>();
+    NamedList<Object> nl = new NamedList<>(sz);
     for (int i = 0; i < sz; i++) {
       String name = (String) readVal(dis);
       Object val = readVal(dis);
@@ -512,7 +512,7 @@ public class JavaBinCodec implements PushWriter {
   public SolrDocument readSolrDocument(DataInputInputStream dis) throws IOException {
     tagByte = dis.readByte();
     int size = readSize(dis);
-    SolrDocument doc = new SolrDocument();
+    SolrDocument doc = new SolrDocument(new LinkedHashMap<>(size));
     for (int i = 0; i < size; i++) {
       String fieldName;
       Object obj = readVal(dis); // could be a field name, or a child document
@@ -555,7 +555,7 @@ public class JavaBinCodec implements PushWriter {
   public SolrInputDocument readSolrInputDocument(DataInputInputStream dis) throws IOException
{
     int sz = readVInt(dis);
     float docBoost = (Float)readVal(dis);
-    SolrInputDocument sdoc = new SolrInputDocument();
+    SolrInputDocument sdoc = new SolrInputDocument(new LinkedHashMap<>(sz));
     sdoc.setDocumentBoost(docBoost);
     for (int i = 0; i < sz; i++) {
       float boost = 1.0f;
@@ -610,7 +610,7 @@ public class JavaBinCodec implements PushWriter {
   public Map<Object,Object> readMap(DataInputInputStream dis)
           throws IOException {
     int sz = readVInt(dis);
-    Map<Object,Object> m = new LinkedHashMap<>();
+    Map<Object,Object> m = new LinkedHashMap<>(sz);
     for (int i = 0; i < sz; i++) {
       Object key = readVal(dis);
       Object val = readVal(dis);


Mime
View raw message