Description
Board / MCU
ESP32-S3
LED Chipset
WS2812B / NeoPixel
FastLED Version
master#ea5d8ec
Arduino / PlatformIO version
PlatformIO 6.1.19
Operating System
Windows
Description
Compared to timing performance in 3.10.3, timing performance in master is massively worse. This is even for incredibly simple operations such as writing an update to a single pixel in a loop that does nothing other than write to a new pixel on a specific delay. It appears that timing calls are significantly negatively affected by the current code in master.
Note that for timing we use the incredibly common library millisDelay which is a part of the PIO package powerbroker2/SafeString. With all previous versions of FastLED this has never been a problem, and allows for very tight millisecond-precision timing.
Using rudimentary measurements with a stopwatch, merely switching from 3.10.3 to master using the same demo code added up to a whopping 500ms of additional delay compared to the normal sequence. The normal sequence should take a total of 2500ms to run, and switching to master caused it to randomly exceed 3000ms. On average, rather than taking 2500ms to run, the same code would typically be around 2600ms. However, as mentioned, this timing drift appears to be highly random.
Additionally, the binary size absolutely exploded by changing from 3.10.3 to master. With the exact same example code, 3.10.3 clocked in at 344 kilobytes while master clocks in at 783 kilobytes.
Steps to reproduce
- Target FastLED
master#ea5d8ec. - Compile minimal sketch.
- See that timing precision is significantly more unreliable than
3.10.3.
Minimal sketch
#include <Arduino.h>
#include <millisDelay.h>
#include <FastLED.h>
uint8_t i_post_fade = 255;
#define LED_PIN 4
#define FAST_LED_UPDATE_MS 5
#define NUM_LEDS 35 // 35-LED NeoPixel ring
CRGB leds[NUM_LEDS];
uint8_t i_fast_led_delay = FAST_LED_UPDATE_MS;
millisDelay ms_fast_led;
millisDelay ms_delay_post;
void setup() {
FastLED.addLeds<NEOPIXEL, LED_PIN>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setMaxRefreshRate(0);
FastLED.show();
setCpuFrequencyMhz(160);
Serial.begin(115200);
ms_delay_post.start(0);
ms_fast_led.start(i_fast_led_delay);
}
void updateLEDs() {
if(ms_fast_led.justFinished()) {
FastLED.show();
ms_fast_led.start(i_fast_led_delay);
}
}
void loop() {
if(i_post_fade > 0 && ms_delay_post.justFinished()) {
const uint8_t i_ring_start = 0;
const uint8_t i_ring_end = 34;
const uint8_t i_ring_divisor = 7;
uint8_t i_ring_counter = 0;
i_ring_counter = ((255 - i_post_fade) / i_ring_divisor) + i_ring_start;
if(i_ring_counter <= i_ring_end) {
leds[i_ring_counter] = CRGB::Red;
}
if(i_ring_counter - 1 >= i_ring_start && i_ring_counter - 1 <= i_ring_end) {
leds[i_ring_counter - 1] = CRGB::Black;
}
i_post_fade--;
if(i_post_fade == 0) {
for(uint8_t i = i_ring_start; i <= i_ring_end; i++) {
leds[i] = CRGB::Black;
}
updateLEDs();
delay(1000);
i_post_fade = 255;
ms_delay_post.start(225);
return;
}
else {
ms_delay_post.start(5);
}
}
updateLEDs();
}Checklist
- I have searched existing issues for duplicates
- I have tested with the latest FastLED release or git master
- I can reproduce this with a minimal sketch
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Apr 30, 2026
Thanks for the detailed report and reproducible sketch — the symptom pattern (random ~1ms-per-show drift + ~440KB of bloat) lines up with some architectural changes we made between 3.10.3 and master, and we'd like to confirm with hard data from your build before changing anything.
Could you upload three things from your PlatformIO build directory so we can do symbol-level analysis?
.elffile — typically at.pio/build/<env>/firmware.elf. Lets us runxtensa-esp32s3-elf-nm --size-sort/objdump/bloatyand see exactly which symbols/translation units are consuming the extra ~440 KB..mapfile —.pio/build/<env>/firmware.mapif PlatformIO emitted one. If not, add-Wl,-Map=firmware.map,--crefto yourbuild_flagsand rebuild. Confirms link-time decisions.platformio.ini— so we can reproduce exactly: ESP-IDF version, framework, anybuild_flags, and any FastLED-related defines such asFASTLED_RMT5,FASTLED_USES_ESP32S3_I2S, orCONFIG_FREERTOS_HZ.If size matters, just gzip the .elf — symbol info compresses well. You can drag-drop a zip directly into a GitHub comment box.
A couple of follow-up questions while you grab those:
-DCONFIG_FREERTOS_HZ=1000(or confirm it's already 1000)? The new code path in master ends up callingvTaskDelay(1 tick)per show, so a slower tick rate would amplify the regression by 10x.FastLED.setMaxRefreshRate(800)instead of0? Pure diagnostic — not a recommended fix.I've opened tracking issue #2421 for the architectural investigation and the likely near-term mitigation (a
FASTLED_TIGHT_TIMINGdefine that bypasses the new event-driven wait path for tight-loop sketches like yours). I'll link it back here once filed.zackees commentedon Apr 30, 2026
the reason we do a vTaskDelay(1) is that this is the minimum threshold needed to trigger background tasks. If we don't do this then things like bluetooth and wifi tasks don't run with heavy CPU load for audio processing (bt/wifi - it's a two step process, isr's fill a buffer but it's the task on core 0/1 that actually drains it)
nomakewan commentedon Apr 30, 2026
platformio.ini:
ELF/MAP files:
esp32s3-fastled_master_build.zip
zackees commentedon Apr 30, 2026
Btw please stop using such negative language in your bug reports. The ESP is a highly complex system and FastLED needs to cooperate with it to present a useful HAL. Modifying the shape of fastled to accommodate a major use case may affect a less common path, which is what you are experiencing. As we map out regressions we can determine a more sophisticated shape that accommodates all use cases. And we need to keep the language positive and collaborative. I tend not to over-engineer solutions on v1 but iterate on them based on user reports. And fixing one user's use case may often break someone else.
zackees commentedon Apr 30, 2026
@nomakewan thanks — the elf + map were exactly what we needed. The diagnosis is now confirmed.
TL;DR: Your binary regression of +439 KB is real and is overwhelmingly FastLED's fault, not the toolchain or platform. Symbol-level breakdown of your firmware shows
libFastLED.aalone contributes ~350 KB, plus another ~80 KB from FastLED template instantiations leaking into yourmain.cpp.o, plus ~46 KB of ESP-IDF driver code (UART/SPI/LCD/RMT-RX) that we drag in via static driver registration but your sketch never uses. Total FastLED-attributable bloat in your build: ~476 KB. Matches the +439 KB you reported within noise.Headline offenders (code your sketch provably does not use):
fl.audio+.cpp.o#include "fl/audio/*"in FastLED.hfl.remote+.cpp.o+fl.net+.cpp.ofl/channels/rx.hfl.fx+.cpp.ofl.gfx+.cpp.oplatforms+.cpp.oFull analysis posted on the tracking issue #2421.
On the timing side — could you do one quick A/B for us so we can confirm the per-
show()vTaskDelay(1)hypothesis without instrumentation? In your sketch'ssetup(), add:That keeps the rate-limiter's spin-wait active but with a 1.25ms budget, and crucially the begin-frame
waitForReady()should already see READY on every call. If your 2500ms loop drops back close to 2500ms with this change, that confirms thevTaskDelay(1)floor inChannelManager::onBeginFrame/onEndFrameis the timing culprit. (We're not asking you to ship this as a fix — it's a diagnostic.)Also: do you happen to know what your
CONFIG_FREERTOS_HZis? Arduino-ESP32 typically uses 1000 (1ms tick), but if your sdkconfig is at 100 (10ms tick) the regression would be ~10x worse.We'll work the fixes against #2421. Near-term plan is a
FASTLED_LEAN(or similar) define that gates audio/remote/net/fx/gfx out and provides a tight-timing show path that bypasses the new EngineEvents waits. Long-term plan is per-driver feature gates so the linker can dead-strip the unused driver families. Will tag you when there's something to test.Genuinely appreciate the high-quality bug report — minimal repro + clean A/B numbers + willingness to upload artifacts is the gold standard.
zackees commentedon Apr 30, 2026
The AI analysis is wrong, its looking at the ELF symbols and not the final bin file. I'll have it do a deeper analysis.
nomakewan commentedon Apr 30, 2026
Q: Does the timing drift change if you build with
-DCONFIG_FREERTOS_HZ=1000(or confirm it's already1000)?A: The timing drift does indeed appear to change--instead of being random between 100~500ms, it appears to lock the timing drift to 50ms. That is, my stopwatch test measures 2550ms consistently rather than 2500ms.
Q: Does the drift go away if you call
FastLED.setMaxRefreshRate(800)instead of0?A: Tested both with and without
-DCONFIG_FREERTOS_HZ=1000. With that build flag set, settingFastLED.setMaxRefreshRate(800);caused the timing drift to gain an additional 200ms (iterated every 2750ms instead of 2500ms). Without that build flag set, settingFastLED.setMaxRefreshRate(800);does not seem to affect the drift (it still jitters around the 2600ms mark).Q: For a clean A/B, can you also confirm the binary size for 3.9.x if you have it handy? We want to bracket where the bloat started.
A: Compiling using
3.9.20results in a binary size of 357 KB.3.10.3actually has a slimmer binary at 344 KB for ESP32-S3.Apologies for the delay in getting the responses to these questions to you.
nomakewan commentedon May 1, 2026
I noticed in the tracking issue that there was discussion of the ESP32 log level and stack trace functions. Just for benchmark purposes prior to changes, here are the compile sizes for the three versions of FastLED mentioned above, but with
-D "CORE_DEBUG_LEVEL=0"and-D "LOG_LOCAL_LEVEL=ESP_LOG_NONE"defined inplatformio.ini.FastLED 3.9.20: 340 KB
FastLED 3.10.3: 330 KB
FastLED
master#ea5d8ec: 768 KBfeat(fl/stl): add FL_NO_UNWIND macros, apply to ESP32 unity headers
feat(fl/stl): add FL_NO_UNWIND macros, apply to ESP32 unity headers
nomakewan commentedon May 1, 2026
After #2423 was merged, here are the binary sizes for progress-tracking purposes. In both cases,
-D "FASTLED_FORCE_NO_UNWIND_TABLES=1"is defined inbuild_flags.-D "CORE_DEBUG_LEVEL=0"and-D "LOG_LOCAL_LEVEL=ESP_LOG_NONE":FastLED
master#022402d: 770 KB-D "CORE_DEBUG_LEVEL=3"and-D "LOG_LOCAL_LEVEL=ESP_LOG_INFO":FastLED
master#022402d: 784 KBzackees commentedon May 2, 2026
If binary size is a problem you can remove the available drivers for esp. THat's the escape hatch. I'm seeing stack unwinding bloat for the driver code. It looks like a proper fix will be to bind driver types through an enum template so that only drivers users specify get in.
sigh
zackees commentedon May 9, 2026
Filed #2428 with the proposed fix. Compile-time driver binding (
fl::Busenum + templatedChannelConfig<Chipset>) means a NEOPIXEL-only sketch links one driver instead of all of them — should restore the ~344 KB baseline. The manager-side per-framevTaskDelay(1)floor also disappears in the default path becauseChannelManageris no longer on theshow()call chain.11 remaining items
zackees commentedon May 21, 2026
Cross-reference: same root cause now also hits #2493 (ESP32-P4 PARLIO
show()blocks ~16.7 ms)The 50 ms / 500 ms timing drift you measured (at 1 kHz / 100 Hz
CONFIG_FREERTOS_HZ) is the samevTaskDelay(1)tick floor that #2493 sees as a 16.7 ms block insideFastLED.show()for a 256-LED × 12-strip PARLIO config:That deep-yield was introduced as the fix for #2254 (I2S/PARLIO loops starving WiFi/lwIP — needs ~1 ms wait so the network task layer gets CPU). It's exactly the "ChannelManager per-frame
vTaskDelay(1)floor" you flagged in this thread comment when filing #2428.So the three issues are linked: #2254 motivated the deep-yield → #2420 (timing drift) and #2493 (PARLIO 16.7 ms block) are the regressions → #2428 (compile-time
Busbinding) is the structural fix that removesChannelManagerfrom the defaultshow()path entirely.See #2493 for the per-iteration arithmetic (~8 × 1 ms ticks + 7.6 ms PARLIO DMA ≈ 16 ms) and a one-line workaround (
task::run(0, SYSTEM)→taskYIELD()instead ofvTaskDelay(1)) until #2428 lands.zackees commentedon Jun 5, 2026
Status update — please retest on current
masterSince this report a lot has landed. Summary of what's actually changed for your reproducer (ESP32-S3, stock
addLeds<NEOPIXEL, LED_PIN>legacy path).✅ Binary bloat — addressed
FASTLED_DISABLE_LEGACY_DRIVER_REGISTRYmacro. Drivers now link only when theirBusTraits<Bus::X>::instanceis named.examples/Blink/Blink.inoon ESP32-S3 measured at 657 KB vs the previous 776 KB — no source change, no build flag, no opt-in required. OnlyChannelEngineRMT(the ESP32-S3 default) links; UART / LCD / I2S / SPI driver TUs are garbage-collected.fl::shared_ptrplumbing, pixel iterator) and is no longer a regression — it's the feature tax.If your sketch still measures meaningfully above 657 KB on stock
master, that's a fresh data point — please post it.vTaskDelay(1)floor inChannelManager::waitForConditionandIChannelDriver::waitForCondition— but only on ESP32-P4 (#if defined(FL_IS_ESP_32P4)). ESP32-S3 still hitstask::run(250, ExecFlags::SYSTEM)which floors at 1 ms atCONFIG_FREERTOS_HZ=1000. Confirmed insrc/fl/channels/manager.cpp.hpp:361-370andsrc/fl/channels/driver.cpp.hpp:21-30on current master.addLeds<NEOPIXEL, PIN>path now pre-binds viasetDriver(BusTraits<Bus::RMT>::instancePtr())inClocklessIdf5(seesrc/platforms/esp/32/drivers/rmt/rmt_5/idf5_clockless.h:46-55). SoChannel::showPixels()no longer goes through the per-frameChannelManager::selectDriverForChannelpriority lookup.ChannelManagerviaregisterWithManager()soChannelManager::onBeginFrame()→waitForReady()is still on theCFastLED::show()chain viaEngineEvents::onBeginFrame(). For your 35-LED workload (~1 ms RMT transmission, 5 ms loop), the previous frame's RMT is essentially always READY by the nextshow(), so the wait should return immediately without ever entering the loop body that hitstask::run(250). Theoretically the timing drift should now be gone for your case.master(post-feat(channels): remove FASTLED_DISABLE_LEGACY_DRIVER_REGISTRY (default-as-opt-in, closes binary-bloat half of #2421) #2469) with the same sketch, that confirms whether the regression is gone or whether there's a second cause we haven't pinned.🟡 Related but orthogonal — recent transpose perf work
The recent PARLIO transpose optimizations (#2532, #2534, #2539, #2553, #2555, #2557, #2568) and chipset-aware encode (#2559) — these are PARLIO/Wave8-specific work for ESP32-P4. They don't touch your
addLeds<NEOPIXEL>RMT path on ESP32-S3. Mentioning so it's clear they don't help (or hurt) your case.Recommendation: keep open, pending your retest
I'd suggest leaving this issue open pending one stopwatch retest from you against current
master. The expected outcome based on the code changes is that your 2500 ms loop measures close to 2500 ms again (within sub-ms drift). If it does, we close as fixed. If it doesn't, we have a second cause that #2421's analysis missed and we re-open #2421 with new instrumentation.If you've moved on and can't retest, ping us and we'll close as "presumed fixed by #2469 — reopen with fresh measurements if not."
🤖 Filed via Claude Code on behalf of the FastLED maintainers.
nomakewan commentedon Jun 5, 2026
Retested using commit 565c5d5.
Binary size on this commit is 673KB with default core debug settings, and 659KB with core debugging disabled. Definitely progress towards getting the binary sizes closer to what they were on
3.10.3(as a note, the3.10.3binary size tests were all performed on the exact same ESP-IDF framework as themastertests, which should rule out changes in ESP-IDF since 3.10.3's release as the culprit of this binary size increase).Regarding timing, unfortunately this did not resolve the issue. When the sketch is first loaded to the ESP32-S3, timing seems to hover between 2550ms and 2600ms; tighter than
master#ea5d8eccertainly but still not 2500ms as expected. The problem is that the longer you leave this simple sketch running the more the timing drifts, eventually settling around 3000ms per cycle.zackees commentedon Jun 5, 2026
Are you claiming
fl::millis()clock itself is drifting?nomakewan commentedon Jun 5, 2026
I don't think so, unless FastLED is inserting itself into every single piece of user code overriding anything and everything that touches timekeeping-related functionality.
In the sketch above, as noted, I am using the library
millisDelayfrompowerbroker2/SafeStringto handle timing.Here is a direct link to its source code in case you would like to take a look and see what it's doing: https://github.com/PowerBroker2/SafeString/blob/master/src/millisDelay.cpp
zackees commentedon Jun 5, 2026
Status check — related work merged since report
Several PRs landed that touch the timing/wait-loop paths potentially implicated here:
fix(channels): skip vTaskDelay(1) floor in wait-loop on ESP32-P4 (#2493 follow-up)— addresses a tick-floor floor in the post-show wait loop. Originally scoped to ESP32-P4 but worth re-checking on ESP32-S3 since the wait-loop is shared.feat(channels): remove FASTLED_DISABLE_LEGACY_DRIVER_REGISTRY (default-as-opt-in, closes binary-bloat half of #2421)— the binary-bloat half of this report has its own line of work in [Tracking] ESP32-S3 timing regression + binary bloat from Channel API (from #2420) #2421/feat(channels): remove FASTLED_DISABLE_LEGACY_DRIVER_REGISTRY (default-as-opt-in, closes binary-bloat half of #2421) #2469 + ongoing in meta Meta: ESP32-S3 binary-size reduction — Batch 1 (~26 KB) + Batch 2 (~26–50 KB) (supersedes #2771) #2773.delay()accuracy depending on what got moved.What would unblock progress
A fresh reproduction would be the single highest-leverage thing right now. Specifically, on current master (
787de450dor later), on the same ESP32-S3 hardware with the same demo usingmillisDelay:bash compile esp32s3 --examples <repro-sketch>.micros()deltas between iterations (so the regression has a numeric signature, not a stopwatch one).bash autoresearch esp32s3 ...already has a hardware harness that can drive deterministic timing measurements — using it would beat a manual stopwatch.Without hardware confirmation we can't tell from this box whether the merged work above resolved it, partially resolved it, or left it untouched.
Binary size half of the original report
The "344 KB → 657 KB" delta is tracked separately in #2773 (the actionable meta replacing #2771). The original 657 KB number has since been chipped at by #2778 / #2782 / #2786 and others. Closing the size half here as a duplicate of #2773 — leaving the timing half open until reproduction.
— Automated status update from /loop iteration.
nomakewan commentedon Jun 5, 2026
I have retested using
master#787de450das instructed. The original timing variation from the initial report has now returned, with the initial program variation fluctuating between 2600ms and 2800ms. However, the issue where leaving the program running would cause this error to eventually max out at each iteraction taking 3000ms is no longer present.zackees commentedon Jun 5, 2026
@nomakewan filed #2815 with a proposal to eliminate the ~1 ms FreeRTOS-tick floor inside
ChannelManager::waitForReady()that is the root cause of the timing drift here. Two-track plan: (1) per-driver ISR-completion semaphore wait (most drivers already have one), (2) gate the deep WiFi-friendly yield on the existingfl::NetworkDetector::isAnyNetworkActive()at runtime so sketches without WiFi/BT brought up (like yours) get a fastfl::yield()path instead ofvTaskDelay(>=1 tick).Independent of that fix: as a workaround that may help today, FastLED ships a built-in
fl::task::every_ms()pacing primitive that can replace yourmillisDelayusage and is integrated with the engine event loop:It won't eliminate the show() tick cost on master until #2815 lands, but it lets you drop the
powerbroker2/SafeStringdependency if you'd like to standardize on FastLED's own scheduler.perf(channels): runtime NetworkDetector-gated yield in waitForConditi…
perf(channels): add Tier-2 microsecond spin to waitForCondition (Phas…
zackees commentedon Jun 9, 2026
Closing the timing half of this report as resolved by #2992, which merged to
masteron 2026-06-09.The focused follow-up for this regression was #2991. PR #2992 landed ISR-backed channel poll wakeups so ESP32 drivers can wake the channel manager from ISR-visible progress instead of waiting for a FreeRTOS tick-scale polling path. It also added an AutoResearch
--tight-timingmetric that measuresFastLED.show(); FastLED.wait()overhead directly.Hardware validation from #2992:
That result covers the ESP32-S3
FastLED.show()timing regression tracked here. The binary-size portion was split out earlier and remains separate from this timing closure; ongoing size work is tracked in the bloat-reduction issues rather than this bug.If current
masterstill shows measurable drift on the original 35-LED ESP32-S3 repro, please open a fresh issue with serialcycle_ms=ormicros()measurements against the current commit so we can treat it as a new regression signature.