Repository navigation
Conversation
dkharms
force-pushed
the
0-lazy-tid-resolve
branch
from
October 15, 2026 19:31
b40c2a6 to
49cdcf5
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #578 +/- ##
==========================================
+ Coverage 80.09% 80.18% +0.09%
==========================================
Files 261 262 +1
Lines 19769 19910 +141
==========================================
+ Hits 15834 15965 +131
- Misses 3935 3945 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
🔴 Performance DegradationSome benchmarks have degraded compared to the previous run. Show table
|
cheb0
approved these changes
Oct 21, 2026
dkharms
force-pushed
the
0-lazy-tid-resolve
branch
from
October 27, 2026 12:06
49cdcf5 to
1b2fbbf
Compare
Contributor
🔴 Performance DegradationSome benchmarks have degraded compared to the previous run. Show table
|
dkharms
force-pushed
the
0-lazy-tid-resolve
branch
from
November 9, 2026 08:23
1b2fbbf to
5cc3063
Compare
Contributor
🔴 Performance DegradationSome benchmarks have degraded compared to the previous run. Show table
|
This branch has not been deployed
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.
Description
This PR fixes two problems in how
ANDsubtrees of a search query are evaluated against a fraction:TIDinANDsubtrees;ANDsubtrees in the eval tree;TIDresolve orderThe order in which leaves are resolved into set of
TIDis effectively chosen by the user: it follows the query as written. This hurts needle searches over wide time ranges.The cheapest strategy is to resolve the needle first: most likely it is absent from the fraction, so the whole
ANDsubtree collapses and the fraction is skipped without touching the other leaves.For example, in
service:foo-* AND trace_id:needleit is much cheaper to resolvetrace_idfirst and skip most fractions right away. In the same way, a*substring*leaf next to a needle is never scanned in fractions that do not contain the needle.mean (ms)stddev (ms)p(50) (ms)p(95) (ms)p(99) (ms)iterationstotal11.317.52-33.50%1.190.85-28.52%11.477.74-32.49%13.598.88-34.68%107.2544.77-58.26%30300.00%000.00%1002.43868.63-13.35%88.7594.87+6.90%978.44844.26-13.71%1153.411031.82-10.54%1171.551037.10-11.48%2930+3.45%000.00%1693.337.46-99.56%23.020.80-96.54%1704.377.27-99.57%2156.568.90-99.59%2156.5654.13-97.49%1730+76.47%000.00%2945.21680.82-76.88%41.2377.69+88.42%2938.76658.27-77.60%5482.671606.03-70.71%5482.672368.57-56.80%1529+93.33%000.00%ANDshapeIf an$c_1, c_2, \dots, c_n$ , it is better to build the tree so that as few documents as possible flow up from the innermost node.
ANDsubtree has conjunctsConjuncts are sorted by size, which is the sum of the token frequencies stored in token blocks, and chained as$((c_1 \land c_2) \land c_3) \land \dots$ . This way the innermost
ANDproduces the fewest candidates for the outer ones to check.Tokens below the sealing frequency threshold report zero and are treated as the rarest. Fractions without frequencies (active fractions, legacy formats) keep the query order.
mean (ms)stddev (ms)p(50) (ms)p(95) (ms)p(99) (ms)iterationstotal62.1656.56-9.01%6.624.61-30.35%61.0056.85-6.79%73.2565.03-11.22%122.53114.93-6.20%30300.00%440966544096650.00%996.811081.46+8.49%139.47139.55+0.06%1007.321086.48+7.86%1231.621251.50+1.61%3600.311257.20-65.08%2728+3.70%440966544096650.00%23.9516.50-31.12%4.461.92-56.94%25.1816.12-35.98%31.3626.30-16.13%89.1876.58-14.13%30300.00%000.00%1049.88844.49-19.56%109.51105.79-3.40%1038.33858.17-17.35%1219.10979.49-19.65%1230.57989.03-19.63%2830+7.14%000.00%If you are struggling to build intuition check this out
This is trace of post-order tree iteration. As you can see the the price of tree-traversal is reduced dramatically.
If you have used LLM/AI assistance please provide model name and full prompt: