vsop-479 commented on code in PR #12846:
URL: https://github.com/apache/lucene/pull/12846#discussion_r1445677720
##########
lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99SkipWriter.java:
##########
@@ -202,7 +202,11 @@ protected void writeSkipData(int level, DataOutput
skipBuffer) throws IOExceptio
CompetitiveImpactAccumulator competitiveFreqNorms =
curCompetitiveFreqNorms[level];
assert competitiveFreqNorms.getCompetitiveFreqNormPairs().size() > 0;
if (level + 1 < numberOfSkipLevels) {
- curCompetitiveFreqNorms[level + 1].addAll(competitiveFreqNorms);
+ if (curCompetitiveFreqNorms[level + 1].isEmpty()) {
+ curCompetitiveFreqNorms[level + 1].copy(competitiveFreqNorms);
+ } else {
+ curCompetitiveFreqNorms[level + 1].addAll(competitiveFreqNorms);
+ }
Review Comment:
Yes, This optimization only affects non-zero level acc.
I measured the called count with TestTermScore.testRandomTopDocs (numDocs =
TEST_NIGHTLY):
Method | count
-- | --
copy zero level (bufferSkip) | 1270
copy non zero (writeSkipData) | 214
addAll (writeSkipData) | 1196
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]