Skip to content

perf(bench): gate retrieve_data in perf_ir (LAB-12133) - #153

Merged
27Bslash6 merged 2 commits into
mainfrom
lab-12133-perf-ir-retrieve-data
Oct 31, 2026
Merged

27Bslash6 merged 2 commits into
mainfrom
lab-12133-perf-ir-retrieve-data

Conversation

@27Bslash6

@27Bslash6 27Bslash6 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Adds retrieve_data/<size> cases to the perf_ir instruction-count gate, now that ByteStorage::retrieve_data is on main (#146). They run at the storage sizes retrieve uses (40 B, 64 B, 1 KiB, 64 KiB, 1 MiB), on the same envelope, so the two read paths are measured side by side.

Budgets

Recorded on x86_64 Linux, rustc 1.98.1 and valgrind 3.22.0, the toolchain the committed set was taken on. Every other case measures exactly at its committed budget on this toolchain, so the instrument matches the recorded one.

Case retrieve_data retrieve (new budget) retrieve (old budget)
40 2,471 2,637 2,560
64 2,464 2,630 2,552
1024 7,243 7,409 7,323
65536 391,809 391,975 391,697
1048576 6,679,184 6,679,353 6,676,538

Page faults: 0 per 1,000 ops at 64 KiB and 1 MiB for both.

Why retrieve's budgets go up

The bench is built with fat LTO, so the cases in one binary shape each other's code. On main, retrieve is the only caller of decode_envelope, and LLVM inlines it into retrieve: the symbol is absent from the bench binary. With retrieve_data as a second caller, decode_envelope is emitted once, out of line, and both call it. Measured on main without this change, retrieve is 2,569 / 2,561 / 7,332 Ir/op at 40 B / 64 B / 1 KiB (+0.35% over budget at 40 B, the figure #146's CI reported). With this change it is 2,637 / 2,630 / 7,409: the second caller costs retrieve 68 to 77 Ir/op (+2.6% at 40 B), with the library code unchanged.

This is a change to the instrument, not a library regression, so retrieve's five budgets are re-recorded with --allow-increase. The README's "Instruction counts" section says so, so the next reader does not chase it. A consumer that calls only one of the two read functions gets the decode inlined.

Verification

  • make perf-ir-vs-base (the CI form, base origin/main): PASS, every case ok, retrieve_data/* measured on the base too.
  • make perf-ir against the committed budgets: no FAIL. store/* reports LOWER on this host (store/40 533 against a budget of 1,186), on this PR and on main alike. It is left alone here.
  • cargo fmt --check and cargo clippy --features encryption --benches -D warnings pass.

Docs

README "Instruction counts": the case table lists retrieve_data/<size>, the size paragraph names it, and a note covers the LTO coupling above.

Closes LAB-12133

Adds retrieve_data/<size> at the storage sizes (40 B to 1 MiB) on the
same envelope as retrieve, with budgets on rustc 1.98.1 and valgrind
3.22.0. A second caller keeps decode_envelope out of line under fat LTO,
which moves retrieve by about 70 Ir/op at small sizes, so its budgets are
re-recorded with --allow-increase. The README says why.
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 9f76137 and bb315ab.

Files selected for processing: 3
  • README.md
  • benches/perf_ir.rs
  • benches/perf_ir_baselines.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@kodus-27b

kodus-27b Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the `@kody start-review` command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Providing Context (Files & MCPs)

Add these hints in your PR description (or a comment) to unlock deeper checks:

  • Ticket / Acceptance Criteria: `Refs: ABC-123` (Linear/Jira/Asana/ClickUp/Trello) or a direct ticket link.
  • Bugfix Validation: a Sentry/Datadog/Bugsnag event link (or paste the stack trace/error message).
  • Endpoint Risk: mention the route (e.g., `POST /api/payments`) or controller/action name.
  • Attach a repo file as context: use an explicit marker like `@file:docs/guide.mdx#L10-L50` (replace with your real path).
  • API Contract Docs: include `@file:openapi.yaml` or `@file:swagger.json` when changing routes/schemas.
  • Definition of Done / Standards: include `@file:DOD.md` or `@file:CONTRIBUTING.md` if your repo has them.
  • Design System Source of Truth: include `@file:ui/index.ts` (replace with your DS entrypoint path).
  • Feature Flags: include the flag key/name and `@file:flags.ts` / `@file:config.json` (and optionally the PostHog flag name).
  • Edge/CDN Rules: link the Cloudflare rule/zone or describe the intended redirect/header behavior.
  • Attach an MCP tool output: use `@mcp<provider|tool>` (replace with an installed MCP provider + tool, e.g., `@mcp<sentry|events.search>`).
Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

kodus-27b[bot]
kodus-27b Bot previously approved these changes Oct 31, 2026
@kodus-27b

kodus-27b Bot commented Oct 31, 2026

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the `@kody start-review` command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Providing Context (Files & MCPs)

Add these hints in your PR description (or a comment) to unlock deeper checks:

  • Ticket / Acceptance Criteria: `Refs: ABC-123` (Linear/Jira/Asana/ClickUp/Trello) or a direct ticket link.
  • Bugfix Validation: a Sentry/Datadog/Bugsnag event link (or paste the stack trace/error message).
  • Endpoint Risk: mention the route (e.g., `POST /api/payments`) or controller/action name.
  • Attach a repo file as context: use an explicit marker like `@file:docs/guide.mdx#L10-L50` (replace with your real path).
  • API Contract Docs: include `@file:openapi.yaml` or `@file:swagger.json` when changing routes/schemas.
  • Definition of Done / Standards: include `@file:DOD.md` or `@file:CONTRIBUTING.md` if your repo has them.
  • Design System Source of Truth: include `@file:ui/index.ts` (replace with your DS entrypoint path).
  • Feature Flags: include the flag key/name and `@file:flags.ts` / `@file:config.json` (and optionally the PostHog flag name).
  • Edge/CDN Rules: link the Cloudflare rule/zone or describe the intended redirect/header behavior.
  • Attach an MCP tool output: use `@mcp<provider|tool>` (replace with an installed MCP provider + tool, e.g., `@mcp<sentry|events.search>`).
Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

@27Bslash6
27Bslash6 merged commit 619bc00 into main Oct 31, 2026
37 checks passed
@27Bslash6
27Bslash6 deleted the lab-12133-perf-ir-retrieve-data branch October 31, 2026 16:18
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.

1 participant