Repository navigation
perf(stl): force-inline fl:: libc wrapper templates (-76 B ESP32-S3) - #4833
Conversation
…3) (#4827) PR #4830 made fl::memcpy and friends 'template <typename = void>' so libc wins ADL ties. GCC on ESP32-S3 emitted out-of-line clones of the memcpy/memset/memmove wrappers (+98 B). Force-inline them. Also correct the bloat-baseline note from #4830, which wrongly said master was already over budget.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
… (#4835) Any function at namespace scope inside fl (or a sub-namespace) whose name is a libc name (full C11 string.h/stdlib.h, strings.h, POSIX/newlib/glibc extras) must be a 'template <typename FlLibcTag = void>' + FASTLED_FORCE_INLINE wrapper, so unqualified libc calls on fl types stay unambiguous (#4827) and the forwarders stay inline (#4833). fl::libc_impl is exempt; no path allowlist. Fixes found by the rule: - fl::isr::memcpy -> fl::isr::memcopy (internal; matches fl::memcopy) - fl::exit becomes the template wrapper form tests/fl/stl/adl_barrier.cpp now resolves every wrapper unqualified, on CRGB* without a using-directive and under using namespace fl.
Follow-up to #4830 (#4827).
Cause of #4830's ESP32-S3 growth: making
fl::memcpy/memset/memmovetemplates led GCC to emit out-of-line$israclones of the forwarders (+42 +42 +14 B, from CI bloat reports of run 38476137054 vs 38445221273). #4830 re-based the budget saying master was already over; that was wrong (based on a local build; CI measured 341027 on a branch off master).Fix:
FASTLED_FORCE_INLINEon alltemplate <typename FlLibcTag = void>wrappers infl/stl/cstring.h,malloc.h,cstdlib.h.Evidence: local
bash bloat esp32s3 --buildimage 341039 (was 341115), clones absent from report. Budget pinned to the expected CI value 341055 (local + CI's usual +16 B); will re-pin to the measured CI value if different. Baseline note corrected.bash lintclean,bash test --cpp321/321 unit, 96/96 examples.Summary by CodeRabbit
Improvements
Documentation