Skip to content

Commit a9733ba

Browse files
committed
Keep buffered union refill out of line
BufferedUnionScorer is the hot path for full union traversal, including (TopDocs, Count) where Count forces all matches to be visited. After the block-wand intersection changes, LLVM started inlining the refill helper into the advance path, which regressed TOP_100_COUNT union queries even though the union algorithm did not change. Force the refill helper out of line so the advance loop stays small and stable while pruning collectors continue to use Block-WAND. Benchmark on search-benchmark-game TOP_100_COUNT union query set (301 queries, sum of per-query medians): - tantivy 0.26: 0.853646s - main before: 0.918605s - this change: 0.841659s
1 parent 874d54a commit a9733ba

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/query/union/buffered_union.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ pub struct BufferedUnionScorer<TScorer, TScoreCombiner = DoNothingCombiner> {
5555
num_docs: u32,
5656
}
5757

58+
// Keep this helper out-of-line. When LLVM inlines it into
59+
// `BufferedUnionScorer::advance`, the full traversal path used by combined
60+
// collectors such as `(TopDocs, Count)` becomes sensitive to unrelated codegen
61+
// changes and regresses on large unions.
62+
#[inline(never)]
5863
fn refill<TScorer: Scorer, TScoreCombiner: ScoreCombiner>(
5964
scorers: &mut Vec<TScorer>,
6065
bitsets: &mut [TinySet; HORIZON_NUM_TINYBITSETS],

0 commit comments

Comments
 (0)