Skip to content

MOD-19330 perf(numeric): merge the batch's sorted runs instead of re-sorting - #10874

Merged
JonasKruckenberg merged 5 commits into
masterfrom
thierry-14948-merge-runs
Oct 7, 2026
Merged

JonasKruckenberg merged 5 commits into
masterfrom
thierry-14948-merge-runs

Conversation

@ThierryBerger

@ThierryBerger ThierryBerger commented Aug 11, 2026 •

Copy link
Copy Markdown
Collaborator
Benchmark C Rust (master) Rust (this PR) Rust Δ C / Rust (this PR)
filtered n10k k10 12.8 19.0 18.8 −1.0% 0.68
filtered n10k k100 38.2 47.9 43.7 −8.7% 0.87
filtered n100k k10 31.8 48.3 48.6 +0.8% 0.65
filtered n100k k100 36.7 53.7 54.0 +0.5% 0.68
unfiltered n10k k10 18.3 11.4 11.1 −2.2% 1.65
unfiltered n10k k100 28.6 20.2 19.5 −3.3% 1.47
unfiltered n100k k10 40.4 24.3 23.8 −2.2% 1.70
unfiltered n100k k100 54.3 34.5 34.2 −0.8% 1.59
selectivity 1% 172.9 268.8 252.4 −6.1% 0.68
selectivity 10% 36.7 54.9 53.6 −2.4% 0.68
selectivity 50% 56.3 59.1 59.3 +0.4% 0.95
expensive child 1% 200.6 288.4 270.2 −6.3% 0.74
expensive child 10% 94.1 102.0 101.0 −1.0% 0.93
expensive child 50% 153.1 144.2 143.8 −0.2% 1.06
bounded unfiltered k10 118.9 64.1 52.1 −18.6% 2.28
bounded unfiltered k1000 260.7 163.5 150.9 −7.7% 1.73
bounded filtered k100 100.8 121.5 109.5 −10.0% 0.92
bounded single-value excluded 664.3 652.7 655.4 +0.4% 1.01

This PR also adds more benchmarks: bounded*

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Release Notes

  • This PR requires release notes
  • This PR does not require release notes

If a release note is required (bug fix / new feature / enhancement), describe the user impact of this PR in the title.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 686f980f8f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ThierryBerger ThierryBerger mentioned this pull request Aug 11, 2026
1 of 4 tasks
@codecov

codecov Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.59%. Comparing base (425635b) to head (00de96c).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10874      +/-   ##
==========================================
- Coverage   84.22%   83.59%   -0.64%     
==========================================
  Files         650      674      +24     
  Lines       85392    86531    +1139     
  Branches    39637    40776    +1139     
==========================================
+ Hits        71924    72338     +414     
- Misses      13104    13821     +717     
- Partials      364      372       +8     
Flag Coverage Δ
flow 84.56% <ø> (-0.05%) ⬇️
unit 59.01% <100.00%> (-0.28%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@ThierryBerger
ThierryBerger force-pushed the thierry-14948-merge-runs branch from 686f980 to 76ad1fb Compare August 11, 2026 15:39
@ThierryBerger
ThierryBerger force-pushed the thierry-14948-merge-runs branch from 76ad1fb to 3dae0df Compare August 11, 2026 16:02
@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3dae0df8b8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ThierryBerger
ThierryBerger force-pushed the thierry-14948-merge-runs branch from 3dae0df to 88dec0c Compare September 22, 2026 06:59
@ThierryBerger
ThierryBerger force-pushed the thierry-14948-merge-runs branch from 88dec0c to 9464e13 Compare September 22, 2026 08:47
@ThierryBerger
ThierryBerger force-pushed the thierry-14948-merge-runs branch from 9464e13 to 20d722b Compare September 23, 2026 08:31

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 20d722b220

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ThierryBerger
ThierryBerger force-pushed the thierry-14948-merge-runs branch from 20d722b to 023db8a Compare September 24, 2026 13:56
Base automatically changed from thierry-17353-coalesce to master September 24, 2026 15:24
@ThierryBerger
ThierryBerger force-pushed the thierry-14948-merge-runs branch from 023db8a to 998aa84 Compare September 25, 2026 07:08

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 998aa84995

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 42d715323c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@GuyAv46 GuyAv46 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  1. I think we can keep the unstable sort.
  2. Let's refresh the perf table afterward?

@JonasKruckenberg

JonasKruckenberg commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

okay here is the benchmark results pre-unstable-sort (on my machine)

Benchmark C Rust (master) Rust (this PR) Rust Δ C / Rust (this PR)
filtered n10k k10 10.9 18.4 17.4 −5.5% 0.62
filtered n10k k100 32.7 46.3 40.3 −12.8% 0.81
filtered n100k k10 28.9 50.5 48.6 −3.7% 0.59
filtered n100k k100 34.1 55.4 53.8 −3.0% 0.63
unfiltered n10k k10 13.7 7.9 7.2 −9.0% 1.89
unfiltered n10k k100 26.1 17.4 16.5 −4.7% 1.57
unfiltered n100k k10 31.0 16.0 14.7 −8.0% 2.11
unfiltered n100k k100 47.1 27.7 26.5 −4.5% 1.78
selectivity 1% 133.0 210.0 191.3 −8.9% 0.70
selectivity 10% 34.0 55.6 53.7 −3.5% 0.63
selectivity 50% 50.0 54.0 52.1 −3.5% 0.96
expensive child 1% 153.4 221.4 204.9 −7.4% 0.75
expensive child 10% 86.3 89.9 86.6 −3.7% 1.00
expensive child 50% 153.7 142.5 140.3 −1.5% 1.10
bounded unfiltered k10 93.2 46.7 33.4 −28.5% 2.79
bounded unfiltered k1000 259.3 168.2 153.1 −8.9% 1.69
bounded filtered k100 87.0 124.8 109.7 −12.0% 0.79
bounded single-value excluded 535.8 524.7 519.1 −1.1% 1.03

here are the result with unstable_sort_by_key

Benchmark C Rust (master) Rust (this PR) Rust Δ C / Rust (this PR)
filtered n10k k10 10.6 18.5 17.7 −4.1% 0.60
filtered n10k k100 32.2 46.1 45.4 −1.5% 0.71
filtered n100k k10 27.9 50.3 48.6 −3.3% 0.57
filtered n100k k100 33.0 55.4 53.5 −3.4% 0.62
unfiltered n10k k10 13.5 7.9 7.3 −8.5% 1.86
unfiltered n10k k100 26.1 17.3 16.6 −3.7% 1.57
unfiltered n100k k10 29.8 16.0 14.8 −7.7% 2.02
unfiltered n100k k100 46.1 27.7 26.3 −5.0% 1.75
selectivity 1% 131.6 209.9 207.3 −1.2% 0.63
selectivity 10% 32.8 55.0 53.8 −2.3% 0.61
selectivity 50% 49.3 53.8 52.2 −3.1% 0.95
expensive child 1% 152.7 222.4 218.8 −1.6% 0.70
expensive child 10% 79.5 89.7 87.4 −2.6% 0.91
expensive child 50% 144.9 143.1 140.9 −1.5% 1.03
bounded unfiltered k10 92.2 46.4 45.5 −2.1% 2.03
bounded unfiltered k1000 256.8 168.1 166.1 −1.2% 1.55
bounded filtered k100 85.5 125.1 123.8 −1.0% 0.69
bounded single-value excluded 529.9 525.4 524.6 −0.1% 1.01

so using unstable_sort_by_key makes effectively no difference (maybe a slight regression but below noise prob)

@JonasKruckenberg
JonasKruckenberg force-pushed the thierry-14948-merge-runs branch from 2272308 to ef9c20c Compare October 5, 2026 09:38
@github-actions github-actions Bot added size:L and removed size:M labels Oct 5, 2026
@JonasKruckenberg
JonasKruckenberg force-pushed the thierry-14948-merge-runs branch from ef9c20c to 7bf46ef Compare October 5, 2026 11:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7bf46ef41d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@JonasKruckenberg JonasKruckenberg changed the title perf(numeric): merge the batch's sorted runs instead of re-sorting MOD-19330 perf(numeric): merge the batch's sorted runs instead of re-sorting Oct 5, 2026
Comment thread numeric_top_k_table.py Fixed
@JonasKruckenberg
JonasKruckenberg force-pushed the thierry-14948-merge-runs branch from 7bf46ef to 7f505e5 Compare October 5, 2026 11:47
@github-actions github-actions Bot added size:M and removed size:L labels Oct 5, 2026
@JonasKruckenberg

Copy link
Copy Markdown
Collaborator

@GuyAv46 as it turns out, sort (the stable sort) was performance load-bearing after all. Not because it's stable, but because the algorithm used (drift sort) will preserve sorted runs. unstable_sort is faster for unsorted inputs and consumes less memory, but since the batches we pull are already sorted in ascending order Rusts stable sort is around 1.5–4× faster.

ThierryBerger and others added 5 commits October 6, 2026 12:54
…lue field against C

Every group queried the whole field, so no range ever passed the filter
only in part. The bounded group queries the middle of the field and a
single-value range the filter excludes; the C shim now takes the filter
bounds so both sides run the same query.

No group indexed a multivalue field either, so the full read that keeps a
document on its best value went unmeasured. The multivalue group gives
every document two values in different ranges.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…rtly admits

A range that passes the filter only in part may yield none of its
documents, and a single-value range never splits, so reserving its full
num_docs could allocate ~16 B per doc for an empty batch. Capping such a
range at MAXIMUM_RANGE_SIZE keeps the reservation unchanged for every
leaf the tree can split, so bounded-filter batches still fill without
reallocating.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
On a multivalue field a range wholly inside the filter can still yield
nothing: the docs it holds may all have been emitted by an earlier
batch. Its num_docs is an upper bound there, so cap it at
MAXIMUM_RANGE_SIZE like a partly admitted range, keeping the exact
reservation for single-valued fields only.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@JonasKruckenberg
JonasKruckenberg force-pushed the thierry-14948-merge-runs branch from 4375f45 to 00de96c Compare October 6, 2026 10:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T10:59:08.151485Z 00de96c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sonarqubecloud

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@JonasKruckenberg
JonasKruckenberg added this pull request to the merge queue Oct 7, 2026
Merged via the queue into master with commit afc52c5 Oct 7, 2026
60 of 61 checks passed
@JonasKruckenberg
JonasKruckenberg deleted the thierry-14948-merge-runs branch October 7, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants