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
perf: WS2812 encode in SlimBridgeController costs ~115 µs for 35 LEDs (type-erased PixelIterator path) #5357
Sub-issue of #5356 (largest remaining show() cost after #5350).
Measured on an ESP32-C6 on the RMT5 legacy path (bash autoresearch esp32c6 --legacy --rmt), replaying the #2994 workload (35 WS2812 LEDs, show() every 5 ms). Numbers come from temporary per-phase timers, averaged over 864 frames:
the rest of showLedsInternal (adjustment, gates, reserve, enqueue)
~49
The timers add some overhead of their own.
Cause.writeWS2812 encodes through the type-erased PixelIterator. For every pixel, ScaledPixelIteratorRGB::advance() makes four calls through function pointers (has, loadAndScaleRGB, stepDithering, advanceData), and each of the three output bytes then goes through back_inserter, which checks capacity on every byte. That works out to about 3.3 µs (~500 cycles) per pixel for what is three scale-and-store operations.
Fix.SlimBridgeController already holds the concrete PixelController<RGB_ORDER>. For plain RGB (the WS2812 case), encode straight from it into a buffer sized up front, with every call inlined. RGBW and RGBWW keep the PixelIterator path. The output is byte-identical: the same loadAndScaleRGB → stepDithering → advanceData sequence.
Activity
perf(channels): drop the now-dead generic RGB encode from the slim br…
fix(channels): bound the direct RGB encode by the pixels that remain (#…
perf(channels): encode plain-RGB WS2812 frames straight from PixelCon…