You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LPC845 bloat: fl::string::trim() is 2.9 KB single function; basic_string::operator[] 1.5 KB; sstream::operator<<(char) 1.25 KB #3078
trim() at 2,966 bytes is the most surprising — even a generous double-loop implementation should sit under 200 bytes on Cortex-M0+ with -Os. A function this large almost certainly indicates either an inlined factory chain (constructing a new string + copying + holder reference-counting) or an exception-handling unwind cleanup explosion.
Why this is surprising
fl::string is the centerpiece of LPC8xx text handling (JSON parsing, RPC method names). It has been through fefca7b8c1 (drop StrN template) and is expected to be lean. The numbers above suggest some non-obvious codegen multiplier — likely:
operator[](unsigned int) const doing bounds-checking + control-block ref-count traversal in a non-tail-call shape
trim() const returning a new string (forcing allocate + copy + holder construction) instead of returning a string_view
Possible directions
Have trim() return fl::string_view instead of a new owned fl::string — leaves the original buffer untouched, avoids the allocate+copy+holder cascade.
Look at basic_string::operator[](unsigned int) const for unnecessary control-block traversal — it is a read-only access of a single char, should be a load+return.
fl::sstream::operator<<(char) at 1.25 KB suggests the streaming pipeline is doing format-string-style dispatch for a single-char append. Likely a candidate for direct buffer-write specialization.
Repro
Same as parent meta.
Acceptance
fl::string::trim() const drops below 500 bytes on LPC845-BRK LowMemory build
The 9.5 KB / 2.9 KB / 1.5 KB / 1.25 KB numbers reported in this issue are wrong. They came from a one-off Python script that parsed firmware.map for symbol addresses, then attributed the byte-delta to the next symbol's address as the size of the symbol. That methodology is invalid: the linker map only lists a sparse subset of symbols; the address gap between two listed symbols often contains many unlisted intermediates. My parser attributed all that intervening code to the visible neighbor.
Verified by running the real arm-none-eabi-nm --print-size --size-sort on the actual ELF (after forcing the link with a temporary LD-script bump per FastLED/fbuild#594):
Symbol
Claimed
Actual nm size
fl::CRGB::computeAdjustment
9,516 B
54 B (0x36)
fl::string::trim() const
2,966 B
164 B (0xa4)
fl::basic_string::operator[](unsigned int)
1,572 B
32 B (0x20) + 22 B const = 54 B
fl::sstream::operator<<(char)
1,250 B
28 B (0x1c)
All four targets in this issue are within normal small-function sizes. There is no bug here.
The correct top contributors for the LPC845 LowMemory + RX_SCT_WS2812 build are tracked under the revised meta #3079. The reproducibility / methodology gap that made this mistake easy to publish is tracked in FastLED/fbuild#594 (no bash bloat path for arm-none-eabi today; manual parsing was the only option).
Activity
zackees commentedon Jun 15, 2026
Tracked under meta #3079 (LPC845 64 KB flash bloat hunt) alongside three sibling bloat sub-issues and the FastLED/fbuild#594 tooling-gap dependency.
zackees commentedon Jun 15, 2026
Closing as filed in error — retraction.
The 9.5 KB / 2.9 KB / 1.5 KB / 1.25 KB numbers reported in this issue are wrong. They came from a one-off Python script that parsed
firmware.mapfor symbol addresses, then attributed the byte-delta to the next symbol's address as the size of the symbol. That methodology is invalid: the linker map only lists a sparse subset of symbols; the address gap between two listed symbols often contains many unlisted intermediates. My parser attributed all that intervening code to the visible neighbor.Verified by running the real
arm-none-eabi-nm --print-size --size-sorton the actual ELF (after forcing the link with a temporary LD-script bump per FastLED/fbuild#594):nmsizefl::CRGB::computeAdjustmentfl::string::trim() constfl::basic_string::operator[](unsigned int)fl::sstream::operator<<(char)All four targets in this issue are within normal small-function sizes. There is no bug here.
The correct top contributors for the LPC845 LowMemory + RX_SCT_WS2812 build are tracked under the revised meta #3079. The reproducibility / methodology gap that made this mistake easy to publish is tracked in FastLED/fbuild#594 (no
bash bloatpath for arm-none-eabi today; manual parsing was the only option).Apologies for the noise.
feat(format): add generic {} placeholder to fl::printf/snprintf (#3174)…