Repository navigation
chore(bloat): ratchet baseline 350568 -> 350127 (post-#2908 fl::sort_small) - #2909
Merged
Merged
Conversation
…small) Measured against `master @ 731e4d5` (PR #2908 just merged): Total flash: 350,127 B (3,627 sized flash symbols). (was: 350,568 B / 3,631 symbols on master @ 824cb5c) Delta: −441 B / −4 symbols, attributable to the 4 dead-stripped template instantiations from the eliminated quicksort_impl call sites: - fl::detail::quicksort_impl - fl::detail::partition - fl::detail::heap_sort - fl::detail::median_of_three The map-derived attribution to `fl::ClocklessIdf5<...>::ClocklessIdf5()` itself stays at 48,694 B — the rodata-pool blocks anchored under main.cpp.o weren't reachable from the quicksort code, so they don't shift. This is the measured fl::sort_small saving. Real but smaller than the 3-9 KB projected in #2907 — the existing quicksort_impl was more compact than expected. Refs #2886, #2907, #2908.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughSimple update to the ESP32-S3 bloat test baseline, changing the recorded binary size threshold from 350568 to 350127 bytes. ChangesESP32-S3 Bloat Baseline Update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~1 minute Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
This was referenced Jun 7, 2026
zackees
added a commit
that referenced
this pull request
Jun 7, 2026
…rop __ieee754_pow (#2911) Closes #2910. Replaces `fl::pow(double, double)` with `fl::s16x16::pow` (integer fixed-point) in the two FastLED-owned callers that pull `__ieee754_pow` (libm, 2,723 B in the post-#2908 audit) into release builds. ## What changes | File | Site | Before | After | |---|---|---|---| | `src/fl/math/ease.cpp.hpp` | `Gamma8Impl::Gamma8Impl(float)` | `fl::pow(double, double)` per LUT entry | one `fl::s16x16(gamma)` ctor + per-entry `fl::s16x16::pow` | | `src/fl/gfx/colorutils.cpp.hpp` | `applyGamma_video(u8, float)` | bare `pow(orig, gamma)` (float args → double) | `fl::s16x16::pow` | `fl::s16x16::pow` is implemented as `exp2_fp(exp * log2_fp(base))` where `exp2_fp` and `log2_fp` are pure integer LUT-based implementations — zero libm dependency. The chain is broken at the ctor / function entry: the public API still takes `float gamma`, but that float is converted once to `fl::s16x16` via the constexpr ctor (one fmul + cast → `__mulsf3` + `__fixsfsi`, both << 100 B). ## Precision sanity-check - `Gamma8Impl` LUT is u16-valued. `s16x16` has 16 fractional bits (~1.5×10⁻⁵ resolution) — well above the LUT's 16-bit output resolution. - `applyGamma_video` is u8 → u8. Same story. - Result is computed in [0, 1] then scaled to u16 / u8 with round-half-up via integer math: `((raw_u32 * scale) + 0x8000) >> 16`. ## Why s16x16 is enough `s16x16` is 16 integer + 16 fractional bits — range ~[-32768, 32767]. - Gamma values are typically in [1.0, 4.0]: fits with massive headroom. - `(i/255)` is in [0, 1]: stored as raw [0, 65536]. - Intermediate `exp * log2_fp(base)` for `base ∈ (0, 1]` and `exp ∈ [1, 4]`: `log2(base) ∈ [-∞, 0]`, but `s16x16::log2_fp` clamps small inputs. The product stays in s16x16 range. - `exp2_fp(...)` returns [0, ~1] for the gamma case → fits. ## Out of scope - `third_party/cq_kernel/fft_precision.h` — third-party FFT macro-driven. - `third_party/stb/truetype/stb_truetype.cpp.hpp` — third-party font rasterizer. - `fl::pow` fixed-point template specializations — different overloads, not affected. ## Verification - `bash lint --cpp` → all C++ linting checks pass. - `bash test --cpp fl/gfx/gamma_lut` could not be run from the disposable PR worktree due to the known meson source-path bug at #2887. The same diff applied to the main checkout will run on CI's `unit tests linux` job. - Behavior preserved (modulo ±1 LSB rounding from fixed-point vs double): `Gamma8Impl` LUT entries should match the original within rounding precision; `applyGamma_video` preserves the "never-down-to-zero" invariant via explicit `result == 0 → 1`. ## Expected savings - Eliminated: `__ieee754_pow` (2,723 B). - Eliminated: any related double-math symbols only reachable via this path. - Added: `__mulsf3`, `__fixsfsi` (<< 100 B each — likely already linked by other float math sites). - Net: projected ~2-2.5 KB on the ESP32-S3 NEOPIXEL Blink build. The Stage 6 regression gate (`tests/test_esp32s3_bloat_regression.py`, baseline = `350127`) validates the measurement on this PR's CI run. A follow-up commit lowers the baseline file accordingly. Refs #2886, #2910, #2908, #2909.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Measured against `master @ 731e4d5` (PR #2908 just merged):
```
Total flash: 350,127 B (3,627 sized flash symbols).
(was: 350,568 B / 3,631 symbols on master @ 824cb5c)
```
Delta: −441 B / −4 symbols, attributable to the 4 dead-stripped template instantiations from the eliminated quicksort_impl call sites: `fl::detail::quicksort_impl`, `fl::detail::partition`, `fl::detail::heap_sort`, `fl::detail::median_of_three`.
The map-derived attribution to `fl::ClocklessIdf5<...>::ClocklessIdf5()` itself stays at 48,694 B (the rodata-pool blocks anchored under main.cpp.o weren't reachable from the quicksort code, so they don't shift).
Refs #2886, #2907, #2908.
Summary by CodeRabbit