Skip to content

perf: galloping search in static iterator NextGeq - #597

Open
eguguchkin wants to merge 4 commits into
mainfrom
0-galoping2
Open

eguguchkin wants to merge 4 commits into
mainfrom
0-galoping2

Conversation

@eguguchkin

@eguguchkin eguguchkin commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Replaces sort.Search (binary search over the whole remainder) with galloping
(exponential) search in the non-batched static leaf iterators —
staticAsc.NextGeq and staticDesc.NextGeq (node/node_static.go).

Benchmark

BenchmarkStaticNextGeq (node/bench_test.go) drives NextGeq with monotone
targets placed step elements apart, so step is the element distance the
search must cover from the consumption edge:

  • dense — step 2 elements (lockstep zigzag, the typical AND/OR walk);
  • medium — step √N;
  • sparse — step N/64 (rare long skips).

Results (Apple M1 Pro, Go 1.27, -benchtime=2s, ns/match):

size density main (before) this branch (after) Δ
1 000 random 36.5 19.1 −48%
1 000 dense 12.2 9.7 −21%
1 000 medium 15.1 14.9 ~0
1 000 sparse 17.1 13.5 −21%
10 000 random 55.2 31.8 −42%
10 000 dense 13.8 9.6 −31%
10 000 medium 24.4 16.0 −34%
10 000 sparse 20.6 18.9 −8%
1 000 000 random 73.4 37.9 −48%
1 000 000 dense 18.7 9.8 −48%
1 000 000 medium 53.5 21.3 −60%
1 000 000 sparse 28.6 25.7 −10%

@eguguchkin
eguguchkin requested review from cheb0 and forshev November 5, 2026 10:04
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

❌ PR Title Validation Failed
Please refer to CONTRIBUTING.md

@codecov-commenter

codecov-commenter commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.10%. Comparing base (db7c170) to head (497d3c2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #597      +/-   ##
==========================================
+ Coverage   80.09%   80.10%   +0.01%     
==========================================
  Files         261      261              
  Lines       19769    19769              
==========================================
+ Hits        15834    15836       +2     
+ Misses       3935     3933       -2     

☔ View full report in Codecov by Harness.
📢 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.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

❌ PR Title Validation Failed
Please refer to CONTRIBUTING.md

@eguguchkin eguguchkin changed the title 0 galoping2 perf: galloping search in static iterator NextGeq Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

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
AggDeep/size=1000000-4 545c63 16929e
30696.00 B/op 35139.00 B/op 1.14 🔴
And/size=1000/density=dense-4 ------ 16929e
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 7757.00 ns/op NaN 🔴
And/size=1000/density=medium-4 ------ 16929e
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 1007.00 ns/op NaN 🔴
And/size=1000/density=random-4 ------ 16929e
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 10149.00 ns/op NaN 🔴
And/size=1000/density=sparse-4 ------ 16929e
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 1717.00 ns/op NaN 🔴
And/size=10000/density=dense-4 ------ 16929e
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 76721.00 ns/op NaN 🔴
And/size=10000/density=medium-4 ------ 16929e
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 3022.00 ns/op NaN 🔴
And/size=10000/density=random-4 ------ 16929e
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 177014.00 ns/op NaN 🔴
And/size=10000/density=sparse-4 ------ 16929e
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 2115.00 ns/op NaN 🔴
And/size=1000000/density=dense-4 ------ 16929e
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 7619661.00 ns/op NaN 🔴
And/size=1000000/density=medium-4 ------ 16929e
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 33533.00 ns/op NaN 🔴
And/size=1000000/density=random-4 ------ 16929e
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 20795453.00 ns/op NaN 🔴
And/size=1000000/density=sparse-4 ------ 16929e
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 2664.00 ns/op NaN 🔴

Comment thread node/bench_test.go Resolved
Comment thread node/bench_test.go Resolved
@github-actions

github-actions Bot commented Nov 6, 2026

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=1000/density=dense-4 ------ e307ea
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 7694.00 ns/op NaN 🔴
And/size=1000/density=medium-4 ------ e307ea
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 997.50 ns/op NaN 🔴
And/size=1000/density=random-4 ------ e307ea
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 10158.00 ns/op NaN 🔴
And/size=1000/density=sparse-4 ------ e307ea
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 1707.00 ns/op NaN 🔴
And/size=10000/density=dense-4 ------ e307ea
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 76240.00 ns/op NaN 🔴
And/size=10000/density=medium-4 ------ e307ea
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 2985.00 ns/op NaN 🔴
And/size=10000/density=random-4 ------ e307ea
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 174338.00 ns/op NaN 🔴
And/size=10000/density=sparse-4 ------ e307ea
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 2105.00 ns/op NaN 🔴
And/size=1000000/density=dense-4 ------ e307ea
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 7537648.00 ns/op NaN 🔴
And/size=1000000/density=medium-4 ------ e307ea
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 33169.00 ns/op NaN 🔴
And/size=1000000/density=random-4 ------ e307ea
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 20814340.00 ns/op NaN 🔴
And/size=1000000/density=sparse-4 ------ e307ea
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 2676.00 ns/op NaN 🔴

@eguguchkin eguguchkin added this to the v0.83.0 milestone Nov 9, 2026
@eguguchkin
eguguchkin enabled auto-merge (squash) November 9, 2026 10:08
@github-actions

github-actions Bot commented Nov 9, 2026

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
AggDeep/size=1000000-4 db7c17 2b6409
31053.00 B/op 34683.00 B/op 1.12 🔴
And/size=1000/density=dense-4 ------ 2b6409
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 7621.00 ns/op NaN 🔴
And/size=1000/density=medium-4 ------ 2b6409
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 992.20 ns/op NaN 🔴
And/size=1000/density=random-4 ------ 2b6409
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 10010.00 ns/op NaN 🔴
And/size=1000/density=sparse-4 ------ 2b6409
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 1692.00 ns/op NaN 🔴
And/size=10000/density=dense-4 ------ 2b6409
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 76026.00 ns/op NaN 🔴
And/size=10000/density=medium-4 ------ 2b6409
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 2991.00 ns/op NaN 🔴
And/size=10000/density=random-4 ------ 2b6409
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 174288.00 ns/op NaN 🔴
And/size=10000/density=sparse-4 ------ 2b6409
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 2110.00 ns/op NaN 🔴
And/size=1000000/density=dense-4 ------ 2b6409
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 7588378.00 ns/op NaN 🔴
And/size=1000000/density=medium-4 ------ 2b6409
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 33263.00 ns/op NaN 🔴
And/size=1000000/density=random-4 ------ 2b6409
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 20615877.00 ns/op NaN 🔴
And/size=1000000/density=sparse-4 ------ 2b6409
NaN B/op 112.00 B/op NaN 🔴
NaN allocs/op 3.00 allocs/op NaN 🔴
NaN ns/op 2664.00 ns/op NaN 🔴

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants