Skip to content

feat(library-selection): #215 add resolve_warm criterion bench (P-01 mini)#216

Merged
zackees merged 1 commit into
mainfrom
feat/215-resolve-warm-bench
May 10, 2026
Merged

feat(library-selection): #215 add resolve_warm criterion bench (P-01 mini)#216
zackees merged 1 commit into
mainfrom
feat/215-resolve-warm-bench

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented May 10, 2026

Summary

  • Adds crates/fbuild-library-select/benches/resolve_warm.rs, a Criterion bench mirroring resolve_cold.rs that builds the same ~30-library MiniFramework fixture, primes a KvStore with one untimed resolve_cached call, and times only the cache-hit path on the second invocation. Each iteration asserts from_cache == true so a silent regression to miss work can never be reported as warm.
  • Wires the bench into the .github/workflows/bench-205.yml matrix as a third lane (target P-01-mini (warm cache against MiniFramework, baseline TBD)). No CI failure gate yet — the threshold gate lands in a follow-up once we have a stable baseline number.
  • Updates crates/fbuild-library-select/benches/README.md, bench/README.md, and bench/fastled-examples/README.md to reflect that Phase 4 K/V memoization (PR feat(library-selection): #205 Phase 4 zccache K/V memoization #212) shipped and the synthetic warm baseline now exists. The real per-board, per-example FastLED matrix remains future work tracked under bench/fastled-examples/.

Local baseline numbers

Windows host, --release Criterion, same MiniFramework (30 libs, chain depth 5):

bench time
resolve_cold ~5.0 ms
resolve_warm ~1.7 ms

Warm is ~3x faster than cold; the gap is bounded below by the cache-key computation itself, which still hashes seed bodies and canonical library headers (per the cache_key design in cache.rs). That is by design — the cache key has to reflect on-disk content to be sound. Real warm-path wins on a Teensyduino-class tree should be larger because the cold side scales with the LDF reconciliation cost, while the warm side stays near constant.

Test plan

  • uv run soldr cargo build --benches -p fbuild-library-select (clean)
  • uv run soldr cargo bench -p fbuild-library-select --bench resolve_warm (completed; baseline above)
  • uv run soldr cargo bench -p fbuild-library-select --bench resolve_cold (re-run for comparison)
  • uv run soldr cargo clippy --workspace --all-targets -- -D warnings (clean)
  • uv run soldr cargo fmt --all -- --check (clean)

Out of scope

Closes #215
Refs #205

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

Summary by CodeRabbit

  • Tests

    • Introduced a new warm-cache performance benchmark to measure library resolution speed when cache hits occur. The benchmark validates cache behavior to ensure accurate warm-path performance measurements throughout iterations.
  • Documentation

    • Updated benchmark documentation and workflow configuration with comprehensive instructions for running the new warm-cache benchmarks alongside existing cold-path tests. Clarified behavior and measurement approaches for both benchmark types.

Review Change Stack

…mini)

Mirrors resolve_cold.rs but pre-populates a KvStore against the same
~30-library MiniFramework fixture and times only the cache-hit path
through resolve_cached(). Each bench iteration asserts from_cache so a
silent regression to the miss path can never be measured as warm work.

Wires the bench into the .github/workflows/bench-205.yml matrix as a
third lane (P-01-mini, baseline TBD — no failure gate yet) and updates
bench/README.md, the fastled-examples/ placeholder, and the per-crate
benches/README.md to reflect that the synthetic warm baseline now
exists; the real per-board FastLED matrix remains future work.

Local numbers (Windows, debug shell): cold ~5.0 ms, warm ~1.7 ms over
the same MiniFramework tree.

Closes #215
Refs #205

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 653d7c9d-9da2-4ada-89a5-d4dc96763a8a

📥 Commits

Reviewing files that changed from the base of the PR and between eb4e6de and 82348bf.

📒 Files selected for processing (6)
  • .github/workflows/bench-205.yml
  • bench/README.md
  • bench/fastled-examples/README.md
  • crates/fbuild-library-select/Cargo.toml
  • crates/fbuild-library-select/benches/README.md
  • crates/fbuild-library-select/benches/resolve_warm.rs

📝 Walkthrough

Walkthrough

This PR adds a Criterion benchmark that measures the warm cache-hit path for the library resolution algorithm. It builds on the resolve_cached() API introduced in PR #212, creating a companion benchmark to the existing resolve_cold bench using the same MiniFramework fixture but with a pre-populated KvStore. The benchmark is registered in Cargo.toml, documented extensively across multiple README files, and integrated into the CI workflow.

Changes

Warm-cache resolve benchmark

Layer / File(s) Summary
Benchmark Implementation
crates/fbuild-library-select/benches/resolve_warm.rs
New Criterion benchmark with fixture construction (MiniFramework with 30-library chain), cache priming via untimed resolve_cached() miss, validation of cache hit, and a timed loop that asserts every iteration returns a cache hit.
Benchmark Registration
crates/fbuild-library-select/Cargo.toml
New [[bench]] target resolve_warm with harness = false added to the package configuration.
Per-Crate Documentation
crates/fbuild-library-select/benches/README.md
Clarifies resolve_cold invokes resolve() directly without cache; adds new resolve_warm section describing the warm-cache-hit flow with fixture building, KvStore setup, cache priming, and per-iteration assertions.
Top-Level Documentation
bench/README.md, bench/fastled-examples/README.md
Root README adds --bench resolve_warm command; FastLED examples README rewords placeholder to explain synthetic warm baseline exists while the real multi-board harness is reserved; "running today" section lists both cold and warm synthetic benches against MiniFramework.
CI Workflow Integration
.github/workflows/bench-205.yml
Adds fbuild-library-select / resolve_warm entry to the job matrix with target threshold P-01-mini (warm cache against MiniFramework, baseline TBD).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

  • FastLED/fbuild#212: The new resolve_warm benchmark directly exercises the resolve_cached()/KvStore API introduced in PR #212, providing measurement infrastructure for the warm cache-hit path.

Poem

🐰 A warm cache bench hops into view,
Measuring hits when resolve_cached's through—
No cold-path tread, just cache-kissed speed,
P-01 baseline, a metrics seed!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a resolve_warm Criterion benchmark for the fbuild-library-select crate as specified in issue #215.
Linked Issues check ✅ Passed All primary objectives from #215 are met: resolve_warm.rs benchmark added with MiniFramework fixture, KvStore cache-hit path tested, Cargo.toml entry created, workflow integration added, and documentation updated.
Out of Scope Changes check ✅ Passed All changes directly support the stated objectives; no out-of-scope modifications detected. Documentation updates appropriately clarify scope boundaries (bench/fastled-examples remains future work).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/215-resolve-warm-bench

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 and usage tips.

@zackees zackees merged commit 43c2d65 into main May 10, 2026
80 of 83 checks passed
zackees added a commit that referenced this pull request May 10, 2026
…-cache harness

Adds a real-FastLED-matrix bench under `bench/fastled-examples/`,
complementing the synthetic per-crate `resolve_warm` from #216. For each
of a curated subset of FastLED examples (Blink, Pacifica, Animartrix,
Audio, BlurBenchmark, Chromancer), runs `resolve_cached` cold + warm
against a fresh `KvStore` and reports timings. Asserts `from_cache=true`
on the warm pass so silent re-misses surface immediately.

Local numbers (Windows release, FastLED master, 6 examples × synthetic
6-lib Teensyduino-class framework):

| example       | cold (ms) | warm (ms) | speedup |
|---------------|----------:|----------:|--------:|
| Blink         |    923.58 |     11.36 |   81.3x |
| Pacifica      |    915.98 |     12.64 |   72.4x |
| Animartrix    |    970.14 |     11.76 |   82.5x |
| Audio         |    830.51 |     11.74 |   70.7x |
| BlurBenchmark |    827.46 |     10.48 |   79.0x |
| Chromancer    |    844.13 |     10.89 |   77.5x |

Warm path comfortably clears AC#5 (≤ +50 ms over current fbuild) at
~11 ms per example. The asymmetry reflects the cost of walking FastLED
src/ (~1000 files) cold vs. a `KvStore::get` + bincode decode warm.

CI lane added as `workflow_dispatch`-only (needs FastLED checkout step).
No threshold gate yet — capture a stable cross-runner baseline first.

Closes #218. Refs #205 Phase 7.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
zackees added a commit that referenced this pull request May 10, 2026
…-cache harness

Adds a real-FastLED-matrix bench under `bench/fastled-examples/`,
complementing the synthetic per-crate `resolve_warm` from #216. For each
of a curated subset of FastLED examples (Blink, Pacifica, Animartrix,
Audio, BlurBenchmark, Chromancer), runs `resolve_cached` cold + warm
against a fresh `KvStore` and reports timings. Asserts `from_cache=true`
on the warm pass so silent re-misses surface immediately.

Local numbers (Windows release, FastLED master, 6 examples × synthetic
6-lib Teensyduino-class framework):

| example       | cold (ms) | warm (ms) | speedup |
|---------------|----------:|----------:|--------:|
| Blink         |    923.58 |     11.36 |   81.3x |
| Pacifica      |    915.98 |     12.64 |   72.4x |
| Animartrix    |    970.14 |     11.76 |   82.5x |
| Audio         |    830.51 |     11.74 |   70.7x |
| BlurBenchmark |    827.46 |     10.48 |   79.0x |
| Chromancer    |    844.13 |     10.89 |   77.5x |

Warm path comfortably clears AC#5 (≤ +50 ms over current fbuild) at
~11 ms per example. The asymmetry reflects the cost of walking FastLED
src/ (~1000 files) cold vs. a `KvStore::get` + bincode decode warm.

CI lane added as `workflow_dispatch`-only (needs FastLED checkout step).
No threshold gate yet — capture a stable cross-runner baseline first.

Closes #218. Refs #205 Phase 7.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
zackees added a commit that referenced this pull request May 10, 2026
…-cache harness (#219)

Adds a real-FastLED-matrix bench under `bench/fastled-examples/`,
complementing the synthetic per-crate `resolve_warm` from #216. For each
of a curated subset of FastLED examples (Blink, Pacifica, Animartrix,
Audio, BlurBenchmark, Chromancer), runs `resolve_cached` cold + warm
against a fresh `KvStore` and reports timings. Asserts `from_cache=true`
on the warm pass so silent re-misses surface immediately.

Local numbers (Windows release, FastLED master, 6 examples × synthetic
6-lib Teensyduino-class framework):

| example       | cold (ms) | warm (ms) | speedup |
|---------------|----------:|----------:|--------:|
| Blink         |    923.58 |     11.36 |   81.3x |
| Pacifica      |    915.98 |     12.64 |   72.4x |
| Animartrix    |    970.14 |     11.76 |   82.5x |
| Audio         |    830.51 |     11.74 |   70.7x |
| BlurBenchmark |    827.46 |     10.48 |   79.0x |
| Chromancer    |    844.13 |     10.89 |   77.5x |

Warm path comfortably clears AC#5 (≤ +50 ms over current fbuild) at
~11 ms per example. The asymmetry reflects the cost of walking FastLED
src/ (~1000 files) cold vs. a `KvStore::get` + bincode decode warm.

CI lane added as `workflow_dispatch`-only (needs FastLED checkout step).
No threshold gate yet — capture a stable cross-runner baseline first.

Closes #218. Refs #205 Phase 7.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

#205 follow-up: Phase 7 warm-cache resolve bench (resolve_warm)

1 participant