Github user jpountz commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/320#discussion_r167482757
--- Diff: lucene/core/src/java/org/apache/lucene/index/FieldInfos.java ---
@@ -63,21 +62,30 @@ public FieldInfos(FieldInfo[] infos) {
boolean hasNorms = false;
boolean hasDocValues = false;
boolean hasPointValues = false;
-
- TreeMap<Integer, FieldInfo> byNumber = new TreeMap<>();
+
+ int size = 0; // number of elements in byNumberTemp
+ int capacity = 10; // byNumberTemp's capacity
--- End diff --
I think we can simplify a bit by removing these two local variables:
- `capacity` can be replaced with byNumberTemp.length
- `size` seems only useful to terminate early when creating a list of the
field infos from byNumberTemp. But since ArrayUtil.grow is used, arrays are
never more than ~1/8th larger than the number of slots that are actually used,
so it doesn't buy much?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]