Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ Optimizations

* GITHUB#14991: Refactor for loop at PointRangeQuery hot path. (Ge Song)

* GITHUB#14998: Speed up flushing of live docs. (Adrien Grand)

Changes in Runtime Behavior
---------------------
* GITHUB#14823: Decrease TieredMergePolicy's default number of segments per
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,23 @@ public void writeLiveDocs(
}

private int writeBits(IndexOutput output, Bits bits) throws IOException {
int delCount = 0;
final int longCount = FixedBitSet.bits2words(bits.length());
for (int i = 0; i < longCount; ++i) {
long currentBits = 0;
for (int j = i << 6, end = Math.min(j + 63, bits.length() - 1); j <= end; ++j) {
if (bits.get(j)) {
currentBits |= 1L << j; // mod 64
} else {
delCount += 1;
}
int delCount = bits.length();
// Copy bits in batches of 1024 bits at once using Bits#applyMask, which is faster than checking
// bits one by one.
FixedBitSet copy = new FixedBitSet(1024);
for (int offset = 0; offset < bits.length(); offset += copy.length()) {
int numBitsToCopy = Math.min(bits.length() - offset, copy.length());
copy.set(0, copy.length());
if (numBitsToCopy < copy.length()) {
// Clear ghost bits
copy.clear(numBitsToCopy, copy.length());
}
bits.applyMask(copy, offset);
delCount -= copy.cardinality();
int longCount = FixedBitSet.bits2words(numBitsToCopy);
for (int i = 0; i < longCount; ++i) {
output.writeLong(copy.getBits()[i]);
}
output.writeLong(currentBits);
}
return delCount;
}
Expand Down
Loading