Conversation
Since apache#15413, DenseLiveDocs and SparseLiveDocs fall through to the per-bit generic loop in copyOf. Add toFixedBitSet to the LiveDocs interface so copyOf can bulk-copy with one instanceof check instead of walking every document.
Contributor
Author
|
Forgot the benchmark CopyOfBenchmarkAMD EPYC 7R32 (c5a.2xlarge), JDK 25, 3 forks, 5 iters x 3s. DenseLiveDocs:
SparseLiveDocs:
Generic Bits fallback (unchanged):
SoftDeletesReaderBenchmarkSame hardware setup.
|
michaeljmarshall
approved these changes
Sep 3, 2026
|
|
||
| @Setup(Level.Trial) | ||
| public void setup() throws Exception { | ||
| tempDir = Path.of(System.getProperty("java.io.tmpdir"), "softdel-bench-" + System.nanoTime()); |
Replace java.io.File teardown with IOUtils.rm() and apply google-java-format fixes.
Now that apache#16593 is merged, replace per-doc loop with bulk applyMask as suggested by review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After LiveDocs interface was introduced in #15413, FixedBitSet.copyOf fell to per-bit loop execution instead of using the specialized fast paths in Dense/SparseLiveDocs.
This PR addresses that by introducing a toFixedBitSet() method on LiveDocs and a dedicated check in copyOf.
Since there are only two implementations of LiveDocs, both final, the dispatch is bimorphic and inlineable.
copyOf bytecode goes from 90 to 113 bytes, well under the 325-byte FreqInlineSize threshold.
I've included a JMH benchmark and an end-to-end benchmark that measures the impact on SoftDeletesDirectoryReaderWrapper.
Alternative to #16282 which found the same gap but used a different approach.