Skip to content

perf: do not match each token in aggregation#474

Open
dkharms wants to merge 1 commit into
mainfrom
0-skip-matching
Open

perf: do not match each token in aggregation#474
dkharms wants to merge 1 commit into
mainfrom
0-skip-matching

Conversation

@dkharms

@dkharms dkharms commented Jul 24, 2026

Copy link
Copy Markdown
Member

Description

When getting tokens for aggregation, we scan each token and checking it against * -- so basically, useless computations and IO (we have to load+unpack token blocks). I suggest to return range [firstTID; lastTID].

Obviously, this optimization will have more impact on high-cardinality fields that span over several token blocks (like remote_addr or something).

I will collect better measurements but for cold queries (flushed userspace cache and page cache) I got following results:

# query: * | group by (remote_addr) | count

# Before (restart seq-db, flush page cache)
% hyperfine -r=1 'curl --json @search.json http://localhost:9002/complex-search'
Benchmark 1: curl --json @search.json http://localhost:9002/complex-search
  Time (abs ≡):         2.561 s               [User: 0.003 s, System: 0.010 s]

% hyperfine -r=10 'curl --json @search.json http://localhost:9002/complex-search'
Benchmark 1: curl --json @search.json http://localhost:9002/complex-search
  Time (mean ± σ):      1.222 s ±  0.046 s    [User: 0.004 s, System: 0.006 s]
  Range (min … max):    1.163 s …  1.279 s    10 runs

# After (restart seq-db, flush page cache)
% hyperfine -r=1 'curl --json @search.json http://localhost:9002/complex-search'
Benchmark 1: curl --json @search.json http://localhost:9002/complex-search
  Time (abs ≡):         1.440 s               [User: 0.003 s, System: 0.010 s]

% hyperfine -r=10 'curl --json @search.json http://localhost:9002/complex-search'
Benchmark 1: curl --json @search.json http://localhost:9002/complex-search
  Time (mean ± σ):      1.208 s ±  0.051 s    [User: 0.004 s, System: 0.006 s]
  Range (min … max):    1.128 s …  1.277 s    10 runs

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

If you have used LLM/AI assistance please provide model name and full prompt:

Model: {{model-name}}
Prompt: {{prompt}}

@dkharms dkharms added the performance Features or improvements that positively affect seq-db performance label Jul 24, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.75000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 70.46%. Comparing base (4ad8f17) to head (20e3307).

Files with missing lines Patch % Lines
frac/processor/eval_tree.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #474      +/-   ##
==========================================
+ Coverage   70.44%   70.46%   +0.02%     
==========================================
  Files         232      232              
  Lines       18371    18384      +13     
==========================================
+ Hits        12942    12955      +13     
+ Misses       4453     4452       -1     
- Partials      976      977       +1     

☔ 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

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
Indexer-4 4ad8f1 900dcf
677543019.00 B/op 771867370.00 B/op 1.14 🔴

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.

2 participants