Skip to content

perf(channel): gate bus-miss diagnostic probe in release builds (#2952) - #2953

Merged
zackees merged 1 commit into
masterfrom
feat/2952-gate-bus-miss-diag
Jun 7, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/2952-gate-bus-miss-diag

Conversation

@zackees

@zackees zackees commented Jun 7, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Gates the per-frame bus-miss diagnostic block in `resolveDynamicDriver` on `FASTLED_LOG_RUNTIME_ENABLED`.
  • In release the empty FL_ERROR bodies + `driver->getName() != busKey` virtual-call + `findDriverByName` silent probe + `mBusWarned` machinery dead-strip.
  • Functional return value preserved in both builds; only the diagnostic side-effect is gated.

Behavior matrix

Build Bus canHandle Behaviour
Debug typed no One-shot FL_ERROR with remediation hint
Debug AUTO n/a Silent
Release typed no Caller's `if (!driver) return;` skips frame; no diagnostic
Release AUTO n/a Silent (same as debug)

Test plan

Closes #2952. Refs #2886.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Optimized release builds by gating diagnostic logic behind conditional compilation flags, reducing unnecessary checks while maintaining functional behavior.

resolveDynamicDriver runs per-frame for non-pre-bound channels. The
diagnostic block at channel.cpp.hpp:414-438 includes:

  - the per-frame `driver->getName() != busKey` virtual-call +
    fl::string compare (deciding silent-miss vs. diagnosed-miss),
  - the silent `ChannelManager::findDriverByName(busKey)` probe (used
    only to differentiate the FL_ERROR message),
  - mBusWarned reads/writes,
  - the empty `if (!driver) {}` branch with the no-compatible-driver
    FL_ERROR.

In release builds the FL_ERROR bodies collapse to do-while-0, but the
surrounding code still runs — burning cycles + flash bytes for an
unrendered diagnostic.

Gate the whole block on FASTLED_LOG_RUNTIME_ENABLED. The functional
`return driver` is preserved unconditionally; only the diagnostic
side-effect is gated.

Same dead-strip cascade pattern as #2918 / #2925 / #2929 / #2943 /
#2950.

Closes #2952. Refs #2886.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

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: 91ea16a2-ab0d-4851-823e-be0ef46fe3ec

📥 Commits

Reviewing files that changed from the base of the PR and between ea5bd70 and 6899530.

📒 Files selected for processing (1)
  • src/fl/channels/channel.cpp.hpp

📝 Walkthrough

Walkthrough

This PR gates the per-frame bus-key miss diagnostic probe behind FASTLED_LOG_RUNTIME_ENABLED in Channel::resolveDynamicDriver(). The diagnostic chain—which includes findDriverByName() lookups, string comparisons, and conditional FL_ERROR messages—now compiles out in release builds while preserving the functional driver-resolution return behavior unconditionally.

Changes

Bus-miss diagnostic gating

Layer / File(s) Summary
Diagnostic probe gating and documentation
src/fl/channels/channel.cpp.hpp
The bus-key miss diagnostic block (lines 414–438) that probes for missing/incompatible drivers is now wrapped in #if FASTLED_LOG_RUNTIME_ENABLED, and updated comments clarify that the per-frame findDriverByName probe and error-message branching are omitted in release builds while the functional return path remains unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

  • FastLED/FastLED#2952: This PR directly implements the deliverable outlined in issue #2952—gating the bus-miss diagnostic probe on FASTLED_LOG_RUNTIME_ENABLED to remove diagnostic-only bloat (findDriverByName probes, string comparisons, and empty FL_ERROR bodies) from release builds.
  • FastLED/FastLED#2923: Related pattern—both gate diagnostic message/emission chains behind FASTLED_LOG_RUNTIME_ENABLED to remove cold-path diagnostic bloat in release builds.
  • FastLED/FastLED#2950: Related—both gate per-frame diagnostic-only code in src/fl/channels/channel.cpp.hpp for fl::Channel methods using FASTLED_LOG_RUNTIME_ENABLED to preserve functional return paths while removing diagnostic overhead.

Possibly related PRs

  • FastLED/FastLED#2927: Both PRs modify Channel::resolveDynamicDriver() with compile-time gating around the dynamic-driver lookup/diagnostic chain (this PR gates the bus-key miss diagnostics via FASTLED_LOG_RUNTIME_ENABLED, while #2927 gates the whole dynamic-driver resolution via FASTLED_DISABLE_DYNAMIC_DRIVER).
  • FastLED/FastLED#2951: Both PRs in src/fl/channels/channel.cpp.hpp gate Channel diagnostic/error emission behind FASTLED_LOG_RUNTIME_ENABLED (one in resolveDynamicDriver() for bus-key miss probing, the other in showPixels() for disabled-driver warnings).
  • FastLED/FastLED#2456: Both target the same missing-driver-by-name diagnostic behavior via findDriverByName, though this PR gates the diagnostic chain while #2456 rewrites the missing-affinity path.

Poem

🐰 A gate for the probes that chatter and pry,
In release builds they wisely pass by.
Diagnostics still whisper when debug is near,
But bloat in production—we've conquered that fear!
hops with glee 🐇✨

🚥 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 clearly and concisely summarizes the primary change: gating a bus-miss diagnostic probe behind a compile-time flag for release builds.
Linked Issues check ✅ Passed The code changes fully satisfy all coding requirements from issue #2952: diagnostic block wrapped in FASTLED_LOG_RUNTIME_ENABLED, functional driver return preserved unconditionally, and no mBusWarned removal.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the objective of gating the bus-miss diagnostic probe; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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/2952-gate-bus-miss-diag

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Gate resolveDynamicDriver bus-miss diagnostic probe in release builds

1 participant