jpountz commented on a change in pull request #1948:
URL: https://github.com/apache/lucene-solr/pull/1948#discussion_r505828399
##########
File path: lucene/core/src/java/org/apache/lucene/index/OrdinalMap.java
##########
@@ -271,13 +273,26 @@ protected boolean lessThan(TermsEnumIndex a,
TermsEnumIndex b) {
globalOrd++;
}
- this.firstSegments = firstSegments.build();
- this.globalOrdDeltas = globalOrdDeltas.build();
+ long ramBytesUsed = BASE_RAM_BYTES_USED + segmentMap.ramBytesUsed();
+ this.valueCount = globalOrd;
+
+ // If the first segment contains all of the global ords, then we can apply
a small optimization
+ // and hardcode the first segments and global ord deltas as all zeroes.
+ if (ordDeltaBits.length > 0 && ordDeltaBits[0] == 0L &&
ordDeltas[0].size() == this.valueCount) {
Review comment:
> I think 2nd and 3rd segments also might have all 0s ord deltas? But we
can try to optimize that in a followon issue ... progress not perfection!
I wonder if you are confused here, the proposed changes optimize the mapping
from global ordinals to the ordinals of one arbitrary segment. When a segment
has all value, we can simplify by always picking this segment, but there is no
need to optimize this for the 2nd or 3rd segments, since we only need to be
able to translate global ordinals to the ordinal of a single segment. Or maybe
I'm the one confused by what you were suggesting. :)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]