Skip to content

perf: implement NextGEQ#345

Merged
cheb0 merged 42 commits intomainfrom
332-next-geq
Mar 23, 2026
Merged

perf: implement NextGEQ#345
cheb0 merged 42 commits intomainfrom
332-next-geq

Conversation

@cheb0
Copy link
Copy Markdown
Collaborator

@cheb0 cheb0 commented Feb 6, 2026

Description

A new operation which boosts search and aggregation performance. It's implemented on top of faster cmp branch because fast compares are vital for this operation. It's also a base for future improvements like skipping disk reads.

Currently, NextGeq works more like a hint - some nodes do not support it and NextGeq behaviour is same as Next. Therefore, some operations still have loops even when calling NextGeq (i.e. scrolling past lower values), like in aggregator.go. Might be improved in future.

Measurements

Performance improvement depends on a particular operation and search request (and even tokens). If we can skip a lot, then there is a lot of improvement.

For example, service:X AND level:3 speeds up by 60% when level:3 is used, and speeds up only by 6% when level:4 is used as second predicate. Because we reduce total number of results with level:3 by a lot, while almost all service logs has level:4.

The performance improvement on typical user aggregation is good, since we skip a lot in agg tree.
service:xyz | group by k8s_pod count(*) (prod fracs)

master: 370-456 ms (hot-cold)
fast cmp: 320-402 ms
next geq: 73-153 ms (-50-70%)

There are also downsides. It's not zero-cost. For example, the case when we iterate the whole tree and there is nothing to skip (i.e. we traverse exactly same paths but there is an extra comparison in NextGeq operation) :
exists:service | group by k8d_pod count(*)
master: 690-821 ms
fast cmp: 600-730 ms
next geq: 662-800 ms (+10% skipping overhead)

However, thanks to faster cmp, it will still be faster than current main branch, i.e. there is no performance downgrade. The next steps are probably to implement some sort of cost based planning (and cardinality estimation) where we can evaluate if there is a skipping potential and disable it altogether, or maybe even avoid constructing an aggregation tree.

Fixes #332


  • I have read and followed all requirements in CONTRIBUTING.md;
  • I used LLM/AI assistance to make this pull request;

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 7, 2026

Codecov Report

❌ Patch coverage is 96.32353% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.57%. Comparing base (1acfc59) to head (0b0a5ba).

Files with missing lines Patch % Lines
frac/sealed/lids/iterator_desc.go 77.77% 4 Missing ⚠️
frac/sealed/lids/iterator_asc.go 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #345      +/-   ##
==========================================
+ Coverage   71.29%   71.57%   +0.28%     
==========================================
  Files         206      206              
  Lines       15156    15290     +134     
==========================================
+ Hits        10805    10944     +139     
+ Misses       3565     3560       -5     
  Partials      786      786              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cheb0 cheb0 changed the title perf: Next GEQ perf: implement NextGEQ Feb 9, 2026
@dkharms dkharms added the performance Features or improvements that positively affect seq-db performance label Feb 10, 2026
@ozontech ozontech deleted a comment from github-actions Bot Feb 13, 2026
@ozontech ozontech deleted a comment from github-actions Bot Feb 13, 2026
@ozontech ozontech deleted a comment from github-actions Bot Feb 13, 2026
@ozontech ozontech deleted a comment from github-actions Bot Feb 13, 2026
@ozontech ozontech deleted a comment from github-actions Bot Feb 13, 2026
@ozontech ozontech deleted a comment from github-actions Bot Feb 13, 2026
@ozontech ozontech deleted a comment from seqbenchbot Feb 13, 2026
@ozontech ozontech deleted a comment from github-actions Bot Feb 13, 2026
@ozontech ozontech deleted a comment from seqbenchbot Feb 15, 2026
@ozontech ozontech deleted a comment from seqbenchbot Feb 15, 2026
@ozontech ozontech deleted a comment from github-actions Bot Feb 15, 2026
@ozontech ozontech deleted a comment from seqbenchbot Feb 15, 2026
@ozontech ozontech deleted a comment from dkharms Feb 15, 2026
@ozontech ozontech deleted a comment from seqbenchbot Feb 15, 2026
@ozontech ozontech deleted a comment from dkharms Feb 15, 2026
@ozontech ozontech deleted a comment from seqbenchbot Feb 15, 2026
@ozontech ozontech deleted a comment from seqbenchbot Feb 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔴 Performance Degradation

Some benchmarks have degraded compared to the previous run.
Click on Show table button to see full list of degraded benchmarks.

Show table
Name Previous Current Ratio Verdict
And/size=1000000-4 8e3eca f18094
4.58 ns/op 5.12 ns/op 1.12 🔴
OrTreeNextGeq/size=1000-4 ------ f18094
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 4.79 ns/op NaN 🔴
OrTreeNextGeq/size=10000-4 ------ f18094
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 4.89 ns/op NaN 🔴
OrTreeNextGeq/size=1000000-4 ------ f18094
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.36 ns/op NaN 🔴

@ozontech ozontech deleted a comment from seqbenchbot Feb 16, 2026
@ozontech ozontech deleted a comment from seqbenchbot Feb 16, 2026
Base automatically changed from 0-fast-cmp-xor to main March 18, 2026 16:33
cheb0 added 3 commits March 18, 2026 20:45
# Conflicts:
#	frac/processor/aggregator.go
#	node/bench_test.go
#	node/node_and.go
# Conflicts:
#	frac/processor/aggregator.go
#	frac/processor/aggregator_test.go
#	frac/sealed/lids/iterator_asc.go
#	frac/sealed/lids/iterator_desc.go
#	node/lid.go
#	node/node.go
#	node/node_and.go
#	node/node_nand.go
#	node/node_or.go
#	node/node_range.go
#	node/node_static.go
#	node/node_test.go
#	node/sourced_node_wrapper.go
@github-actions
Copy link
Copy Markdown
Contributor

🔴 Performance Degradation

Some benchmarks have degraded compared to the previous run.
Click on Show table button to see full list of degraded benchmarks.

Show table
Name Previous Current Ratio Verdict
FindSequence_Random/large-4 8bbe78 a237ba
14227.40 MB/s 12678.05 MB/s 0.89 🔴
Not/size=1000-4 8bbe78 a237ba
4.64 ns/op 5.48 ns/op 1.18 🔴
Not/size=10000-4 8bbe78 a237ba
4.65 ns/op 5.42 ns/op 1.17 🔴
Not/size=1000000-4 8bbe78 a237ba
4.76 ns/op 5.64 ns/op 1.19 🔴
OrTreeNextGeq/size=1000-4 ------ a237ba
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 4.73 ns/op NaN 🔴
OrTreeNextGeq/size=10000-4 ------ a237ba
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 4.75 ns/op NaN 🔴
OrTreeNextGeq/size=1000000-4 ------ a237ba
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.19 ns/op NaN 🔴

@github-actions
Copy link
Copy Markdown
Contributor

🔴 Performance Degradation

Some benchmarks have degraded compared to the previous run.
Click on Show table button to see full list of degraded benchmarks.

Show table
Name Previous Current Ratio Verdict
FindSequence_Random/small-4 8bbe78 8b826a
6735.60 MB/s 4864.17 MB/s 0.72 🔴
39.57 ns/op 52.63 ns/op 1.33 🔴
Not/size=1000-4 8bbe78 8b826a
4.64 ns/op 5.40 ns/op 1.16 🔴
Not/size=10000-4 8bbe78 8b826a
4.65 ns/op 5.41 ns/op 1.16 🔴
Not/size=1000000-4 8bbe78 8b826a
4.76 ns/op 5.56 ns/op 1.17 🔴
OrTreeNextGeq/size=1000-4 ------ 8b826a
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 4.65 ns/op NaN 🔴
OrTreeNextGeq/size=10000-4 ------ 8b826a
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 4.69 ns/op NaN 🔴
OrTreeNextGeq/size=1000000-4 ------ 8b826a
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.11 ns/op NaN 🔴

@github-actions
Copy link
Copy Markdown
Contributor

🔴 Performance Degradation

Some benchmarks have degraded compared to the previous run.
Click on Show table button to see full list of degraded benchmarks.

Show table
Name Previous Current Ratio Verdict
FindSequence_Random/small-4 8bbe78 62d2cd
6735.60 MB/s 5114.94 MB/s 0.76 🔴
39.57 ns/op 50.05 ns/op 1.26 🔴
Not/size=1000-4 8bbe78 62d2cd
4.64 ns/op 5.38 ns/op 1.16 🔴
Not/size=10000-4 8bbe78 62d2cd
4.65 ns/op 5.41 ns/op 1.16 🔴
Not/size=1000000-4 8bbe78 62d2cd
4.76 ns/op 5.53 ns/op 1.16 🔴
OrTreeNextGeq/size=1000-4 ------ 62d2cd
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 4.71 ns/op NaN 🔴
OrTreeNextGeq/size=10000-4 ------ 62d2cd
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 4.67 ns/op NaN 🔴
OrTreeNextGeq/size=1000000-4 ------ 62d2cd
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.29 ns/op NaN 🔴

@github-actions
Copy link
Copy Markdown
Contributor

🔴 Performance Degradation

Some benchmarks have degraded compared to the previous run.
Click on Show table button to see full list of degraded benchmarks.

Show table
Name Previous Current Ratio Verdict
Not/size=1000-4 4e7a41 768c67
4.68 ns/op 5.30 ns/op 1.13 🔴
Not/size=10000-4 4e7a41 768c67
4.71 ns/op 5.33 ns/op 1.13 🔴
Not/size=1000000-4 4e7a41 768c67
4.82 ns/op 5.48 ns/op 1.14 🔴
OrTreeNextGeq/size=1000-4 ------ 768c67
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 4.52 ns/op NaN 🔴
OrTreeNextGeq/size=10000-4 ------ 768c67
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 4.60 ns/op NaN 🔴
OrTreeNextGeq/size=1000000-4 ------ 768c67
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.15 ns/op NaN 🔴

Copy link
Copy Markdown
Member

@dkharms dkharms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge this bad boy.

@github-actions
Copy link
Copy Markdown
Contributor

🔴 Performance Degradation

Some benchmarks have degraded compared to the previous run.
Click on Show table button to see full list of degraded benchmarks.

Show table
Name Previous Current Ratio Verdict
OrTreeNextGeq/size=1000-4 ------ 7608fc
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.03 ns/op NaN 🔴
OrTreeNextGeq/size=10000-4 ------ 7608fc
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.17 ns/op NaN 🔴
OrTreeNextGeq/size=1000000-4 ------ 7608fc
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.85 ns/op NaN 🔴

@github-actions
Copy link
Copy Markdown
Contributor

🔴 Performance Degradation

Some benchmarks have degraded compared to the previous run.
Click on Show table button to see full list of degraded benchmarks.

Show table
Name Previous Current Ratio Verdict
OrTreeNextGeq/size=1000-4 ------ b2fef6
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.25 ns/op NaN 🔴
OrTreeNextGeq/size=10000-4 ------ b2fef6
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.26 ns/op NaN 🔴
OrTreeNextGeq/size=1000000-4 ------ b2fef6
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.92 ns/op NaN 🔴

@github-actions
Copy link
Copy Markdown
Contributor

🔴 Performance Degradation

Some benchmarks have degraded compared to the previous run.
Click on Show table button to see full list of degraded benchmarks.

Show table
Name Previous Current Ratio Verdict
OrTreeNextGeq/size=1000-4 ------ 0b246d
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.12 ns/op NaN 🔴
OrTreeNextGeq/size=10000-4 ------ 0b246d
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.18 ns/op NaN 🔴
OrTreeNextGeq/size=1000000-4 ------ 0b246d
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.79 ns/op NaN 🔴

@github-actions
Copy link
Copy Markdown
Contributor

🔴 Performance Degradation

Some benchmarks have degraded compared to the previous run.
Click on Show table button to see full list of degraded benchmarks.

Show table
Name Previous Current Ratio Verdict
OrTreeNextGeq/size=1000-4 ------ 9345c7
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.16 ns/op NaN 🔴
OrTreeNextGeq/size=10000-4 ------ 9345c7
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.16 ns/op NaN 🔴
OrTreeNextGeq/size=1000000-4 ------ 9345c7
NaN B/op 0.00 B/op NaN 🔴
NaN allocs/op 0.00 allocs/op NaN 🔴
NaN ns/op 5.87 ns/op NaN 🔴

@cheb0 cheb0 merged commit ec0eb71 into main Mar 23, 2026
8 checks passed
@cheb0 cheb0 deleted the 332-next-geq branch March 23, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Features or improvements that positively affect seq-db performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support NextGEQ for inverted index (skipping)

5 participants