Skip to content

perf(bench): make hot_path compile by default, representative and profile-able (LAB-7039) - #97

Merged
27Bslash6 merged 1 commit into
mainfrom
agent/miss-huang/lab-7039-bench-hygiene
Oct 1, 2026
Merged

27Bslash6 merged 1 commit into
mainfrom
agent/miss-huang/lab-7039-bench-hygiene

Conversation

@27Bslash6

Copy link
Copy Markdown
Contributor

Makes the hot_path Criterion bench usable for instruction-count profiling and closer to real workloads.

  • required-features = ["encryption"] on the bench target: a plain cargo bench now skips hot_path instead of failing to compile. make bench is unchanged.
  • [profile.bench] with strip = false and line tables. The release profile's strip = "symbols" also discarded the line tables, so profilers saw only addresses.
  • All fixtures, including the 64 MiB incompressible setup, build lazily inside the routine closure. Criterion calls only closures whose id matches the filter, so a filtered run no longer pays for the 64 MiB setup.
  • New byte_storage/roundtrip_msgpack/<size> (msgpack-encoded records) and byte_storage/roundtrip_incompressible/<size> ids sit beside the original byte_storage/roundtrip/<size> ids, which keep their history. Each corpus prints its LZ4 compressed/raw ratio once (at 64 KB: ramp 0.008, msgpack 0.377, incompressible 1.004).
  • examples/bench_throughput.rs prints the OS/arch instead of a hard-coded machine name.

README's Performance section now says how to run the suite and what the corpora are.

Checks: cargo bench --no-run (no features) exits 0; all 28 ids pass cargo bench --features encryption --bench hot_path -- --test; cargo test --features encryption, cargo clippy --features encryption --all-targets -- -D warnings and cargo fmt --check pass.

Closes LAB-7039

…nd profile-able (LAB-7039)

- required-features = ["encryption"]: a plain cargo bench skips hot_path
  instead of failing to compile.
- [profile.bench] keeps symbols (release strips them, which also dropped the
  line tables), so callgrind/perf resolve function names.
- Fixtures, including the 64 MiB incompressible setup, build lazily inside the
  routine closure, so a filtered run pays only for the ids it selects.
- New byte_storage/roundtrip_msgpack and roundtrip_incompressible corpora beside
  the original ids; each prints its LZ4 ratio once.
- bench_throughput no longer prints a hard-coded machine label.
@kodus-27b

kodus-27b Bot commented Oct 1, 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.

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: cachekit-io/cachekit-core/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 0deb54c4-5c34-4c77-8519-e581815cba42

📥 Commits

Reviewing files that changed from the base of the PR and between 47af1fb and 2d17ca9.

📒 Files selected for processing (4)
  • Cargo.toml
  • README.md
  • benches/hot_path.rs
  • examples/bench_throughput.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


Summary by CodeRabbit

  • Performance

    • Benchmark coverage now includes realistic MessagePack and incompressible data, alongside the existing synthetic data, giving a broader view of storage round-trip performance.
    • Benchmark results include compression ratios for the additional data types and identify the host operating system and architecture.
    • Profiling tools can provide more detailed attribution when analysing benchmark performance.
  • Documentation

    • The performance guide now describes the benchmark data and the feature required to run the suite.

Walkthrough

The benchmark profile retains symbols and line tables, and the hot-path benchmark requires the encryption feature. Round-trip benchmarks now cover synthetic ramp, realistic MessagePack, and incompressible payloads. Large envelope fixtures and encryption plaintext are created lazily.

Changes

Benchmark suite

Layer / File(s) Summary
Benchmark setup and reporting
Cargo.toml, README.md, examples/bench_throughput.rs
The bench profile retains symbols and line tables, and the hot-path benchmark requires the encryption feature. The README describes the benchmark corpora and profile. The throughput header reports the host operating system and architecture.
Round-trip corpus benchmarks
benches/hot_path.rs
The benchmark creates MessagePack and incompressible payloads, reports their compression ratios, and runs round-trip benchmarks for these payloads and the synthetic ramp.
Lazy benchmark fixtures
benches/hot_path.rs
The 64 MiB envelope fixture and encryption plaintext are initialised inside benchmark closures. Envelope encode, decode, store, and retrieve benchmarks use the shared fixture.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 2d17c

The changes broaden benchmark workloads and improve profiling and filtered execution without an established functional regression. No merge-blocking issue remains, subject to normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarises the main benchmark changes: default compilation behaviour, representative workloads, and profiler support.
Description check ✅ Passed The description directly explains the benchmark, profiling, lazy fixture setup, added corpora, documentation updates, and validation results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

Comment @coderabbitai help to get the list of available commands.

@27Bslash6
27Bslash6 merged commit 11e9836 into main Oct 1, 2026
32 checks passed
@27Bslash6
27Bslash6 deleted the agent/miss-huang/lab-7039-bench-hygiene branch October 1, 2026 19:52
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