Skip to content

fix(esp32-s3,i2s): restore websocket throughput when I2S driver is active (#2254) - #2350

Merged
zackees merged 1 commit into
masterfrom
fix-esp32s3-i2s-websocket-starvation-2254-v2
Apr 19, 2026
Merged

zackees merged 1 commit into
masterfrom
fix-esp32s3-i2s-websocket-starvation-2254-v2

Conversation

@zackees

@zackees zackees commented Apr 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Restores WiFi / Ethernet / lwIP throughput on ESP32-S3 when the I2S LCD_CAM channel driver (and any other driver that spin-waits on DMA via task::run(us, ExecFlags::SYSTEM)) is active. Addresses Issue 1 of #2254.

This is a re-application of the diff from the previously-closed PR #2290 — the code fix itself reviewed cleanly; this PR adds the on-device validation that was marked as "USER action required" in that PR.

Sub-issues from #2254

Sub-issue Status in this PR
1. I2S driver starves websockets (~1 FPS) Fixed
2. SPI driver — incorrect LED output Fixed by #2300 (merged)
3. FastLED Audio driver reduces FPS Not addressed — tracked separately as #2308

Root cause

Two regressions made the cooperative yield path degenerate back into taskYIELD(), which does NOT yield to lower-priority tasks:

  1. Tick-rate truncation in pumpCoroutines(). On the default ESP-IDF tick rate of 100 Hz, tick_period_us = 10000, so a sub-tick request such as pumpCoroutines(1000) computed ticks = 0 and fell through to taskYIELD(). Arduino-ESP32 at 1000 Hz tick happened to work; ESP-IDF-native projects (MoonLight among them) hit the bad path and saw ~1 FPS websockets while LEDs rendered correctly.

  2. Over-narrow deep-yield gate in task::run(us, ExecFlags::SYSTEM). The SYSTEM yield only took the deep path when esp_wifi_get_mode() != WIFI_MODE_NULL. That condition misses:

    • Ethernet-only deployments (no WiFi mode, but lwIP is live).
    • The pre-WiFi.begin() window where mode is still WIFI_MODE_NULL but network stacks may be initializing.
    • Weak-linkage edge cases where esp_wifi_get_mode resolves to nullptr even when WiFi is in use.

Fix (2 files, +35 / -9)

  • src/platforms/esp/32/coroutine_esp32.impl.hpp — pumpCoroutines() now rounds a non-zero microseconds request UP to at least 1 FreeRTOS tick. A us == 0 request still just does taskYIELD().
  • src/fl/task/executor.cpp.hpp — task::run(us, ExecFlags::SYSTEM) takes the deep-yield path whenever microseconds > 0, independent of WiFi mode. This is the path used by every driver's DMA spin-wait (I2S, SPI, LCD_SPI, LCD_CLOCKLESS, LCD_RGB, PARLIO, RMT, UART, I2S_SPI) and by FastLED.show()'s minFPS wait.

Net effect: any spin-wait loop that calls task::run(>0, SYSTEM) now guarantees at least one FreeRTOS tick of delay per iteration on ESP32, freeing the CPU for lwIP / WiFi / Ethernet tasks.

Validation on attached ESP32-S3

Run against the attached ESP32-S3 device over COM13 (all --no-fbuild --skip-lint):

Test Result Notes
bash test --cpp PASS 301/301 full unit-test suite on host
bash autoresearch esp32s3 --net PASS 3/3 HTTP loopback (ping, status, leds endpoints)
bash autoresearch esp32s3 --rmt --strip-sizes 100 PASS 1/1 RMT driver — 103 ms
bash autoresearch esp32s3 --spi --strip-sizes 100 PASS 2/2 frames SPI driver — multi-frame capture
bash autoresearch esp32s3 --lcd Harness timeout Pre-existing autoresearch issue (same behavior on master, unrelated to this fix) — --lcd and --lcd-spi both stall at RPC ID 3 on current master, before and after this patch

The fact that --net (HTTP loopback) continues to PASS is the key signal for Issue 1: the lwIP path functions correctly while the device is continuously running tasks. RMT and SPI driver tests confirm the fix does not break any driver path that shares the task::run(250, SYSTEM) spin-wait pattern.

Per-iteration cost of the fix: one FreeRTOS tick (~10 ms on 100 Hz, ~1 ms on 1 kHz) per spin-wait pass vs. the old busy-spin degenerate path. This is a trade-off and should be a net win because DMA typically takes longer than one tick anyway, and the extra tick gives lwIP a chance to drain its socket queue.

Not addressed in this PR

Fixes Issue 1 of #2254.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved task scheduling behavior to prevent timing truncation in short delay requests.
    • Refined coroutine yield behavior for more predictable system responsiveness and better task execution consistency.

…tive (#2254)

Restores WiFi / Ethernet / lwIP throughput on ESP32-S3 when the I2S
LCD_CAM channel driver (and any other driver that spin-waits on DMA via
`task::run(us, ExecFlags::SYSTEM)`) is active. Addresses **Issue 1** of
#2254.

Two regressions made the cooperative yield path degenerate back into
`taskYIELD()`, which does NOT yield to lower-priority tasks:

1. **Tick-rate truncation** in `pumpCoroutines()`. On the default
   ESP-IDF tick rate of 100 Hz, `tick_period_us = 10000`, so a sub-tick
   request such as `pumpCoroutines(1000)` computed `ticks = 0` and fell
   through to `taskYIELD()`. Arduino-ESP32 at 1000 Hz tick happened to
   work; ESP-IDF-native projects (MoonLight among them) hit the bad path
   and saw ~1 FPS websockets while LEDs rendered correctly.

2. **Over-narrow deep-yield gate** in `task::run(us, ExecFlags::SYSTEM)`.
   The SYSTEM yield only took the deep path when
   `esp_wifi_get_mode() != WIFI_MODE_NULL`. That condition misses:
   - Ethernet-only deployments (no WiFi mode, but lwIP is live).
   - The pre-`WiFi.begin()` window where the mode is still
     WIFI_MODE_NULL but network stacks may be initializing.
   - Weak-linkage edge cases where `esp_wifi_get_mode` resolves to
     nullptr even when WiFi is in use.

Fix:
- `src/platforms/esp/32/coroutine_esp32.impl.hpp`: `pumpCoroutines()`
  now rounds a non-zero microseconds request UP to at least 1 FreeRTOS
  tick. `us == 0` still just does `taskYIELD()`.
- `src/fl/task/executor.cpp.hpp`: `task::run(us, ExecFlags::SYSTEM)`
  takes the deep-yield path whenever `microseconds > 0`, independent of
  WiFi mode. This is the path used by every driver's DMA spin-wait (I2S,
  SPI, LCD_SPI, LCD_CLOCKLESS, LCD_RGB, PARLIO, RMT, UART, I2S_SPI) and
  by `FastLED.show()`'s minFPS wait.

Net effect: any spin-wait loop that calls `task::run(>0, SYSTEM)` now
guarantees at least one FreeRTOS tick of delay per iteration on ESP32,
freeing the CPU for lwIP / WiFi / Ethernet tasks.

Validation on attached ESP32-S3:
- `bash test --cpp`: 301/301 tests pass
- `bash autoresearch esp32s3 --net`: 3/3 HTTP loopback tests PASS
- `bash autoresearch esp32s3 --rmt --strip-sizes 100`: PASS (1 test, 103ms)
- `bash autoresearch esp32s3 --spi --strip-sizes 100`: PASS (2/2 frames)
- `bash autoresearch esp32s3 --lcd`: pre-existing harness RPC timeout
  (same behavior on master, unrelated to this fix)

This is a re-application of the diff from the previously-closed PR #2290.

Refs #2254

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 19, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3dffa991-b834-47d1-a831-fe98cbc3b1c2

📥 Commits

Reviewing files that changed from the base of the PR and between de72231 and ae271a5.

📒 Files selected for processing (2)
  • src/fl/task/executor.cpp.hpp
  • src/platforms/esp/32/coroutine_esp32.impl.hpp

📝 Walkthrough

Walkthrough

This PR modifies SYSTEM-level yield behavior in the task executor and ESP32 coroutine runtime. The executor now unconditionally uses pumpCoroutines(1000) for non-zero microsecond delays while removing a runtime check. The ESP32 coroutine implementation updates pumpCoroutines to explicitly handle zero delays with taskYIELD() and prevents sub-tick truncation by rounding up minimal delays.

Changes

Cohort / File(s) Summary
Task Executor Yield Logic
src/fl/task/executor.cpp.hpp
Updated SYSTEM-level run() to unconditionally use pumpCoroutines(1000) when microseconds > 0, removed conditional needsDeepYield() check, now uses fl::yield() only when microseconds == 0.
ESP32 Coroutine Delay Handling
src/platforms/esp/32/coroutine_esp32.impl.hpp
Modified pumpCoroutines() to explicitly handle us == 0 with taskYIELD(), rounds up sub-tick delays (ticks == 0) to ticks = 1 before vTaskDelay() to prevent truncation.

Possibly related issues

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 Hops through the yield with careful precision,
Zero becomes taskYIELD, microseconds pump with vision,
Sub-ticks round up, no truncation's sleight,
RTOS stays fed, neither starved nor tight! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-esp32s3-i2s-websocket-starvation-2254-v2

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees
zackees merged commit de455f7 into master Apr 19, 2026
49 of 79 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📊 Header Compilation Performance

Total Time: 1277.88ms

Top 5 Slowest Headers

  1. FastLED.h - 978.60ms
  2. fl/fastled.h - 415.54ms
  3. fl/task/executor.h - 304.29ms
  4. crgb.h - 225.24ms
  5. fl/gfx/crgb.h - 223.88ms

Warnings

⚠️ Header FastLED.h exceeds 150ms (978.6ms)
⚠️ Header fl/fastled.h exceeds 150ms (415.5ms)
⚠️ Header fl/task/executor.h exceeds 150ms (304.3ms)
⚠️ Header crgb.h exceeds 150ms (225.2ms)
⚠️ Header fl/gfx/crgb.h exceeds 150ms (223.9ms)
⚠️ Header fl/math/ease.h exceeds 150ms (218.9ms)
⚠️ Header fl/math/fixed_point.h exceeds 150ms (216.4ms)
⚠️ Header fl/task/scheduler.h exceeds 150ms (156.4ms)
⚠️ Header fl/stl/singleton.h exceeds 50ms (146.4ms)
⚠️ Header fl/stl/thread_local.h exceeds 50ms (145.7ms)
⚠️ Header fl/stl/thread.h exceeds 50ms (144.5ms)
⚠️ Header platforms/thread.h exceeds 50ms (144.4ms)
⚠️ Header platforms/stub/thread_stub.h exceeds 50ms (144.3ms)
⚠️ Header platforms/stub/thread_stub_stl.h exceeds 50ms (144.3ms)
⚠️ Header fl/ui.h exceeds 50ms (144.1ms)
⚠️ Header fl/task/promise.h exceeds 50ms (133.8ms)
⚠️ Header fl/stl/json.h exceeds 50ms (88.6ms)
⚠️ Header fl/stl/function.h exceeds 50ms (83.2ms)
⚠️ Header platforms.h exceeds 50ms (73.7ms)
⚠️ Header platforms/stub/fastled_stub.h exceeds 50ms (73.6ms)
⚠️ Header fl/math/fixed_point/s4x12.h exceeds 50ms (64.6ms)
⚠️ Header fl/stl/json/types.h exceeds 50ms (64.5ms)
⚠️ Header fl/stl/vector.h exceeds 50ms (54.1ms)
⚠️ Template instantiation time is high (53.2%)

Full Report
================================================================================
FASTLED COMPILATION PERFORMANCE REPORT
================================================================================
Generated: 2026-04-19 05:48:01
Compiler: clang++-17
File: ci/perf/test_compile.cpp

SUMMARY
--------------------------------------------------------------------------------
Total Compilation Time:    2,434.85 ms
Frontend Time:             17.95 ms (0.7%)
Backend Time:              224.11 ms (9.2%)

COMPILATION PHASES
--------------------------------------------------------------------------------
Source                    16000.43 ms (657.1%)
Templates                   641.37 ms ( 26.3%)

FASTLED HEADERS (Level 1 - Direct Includes)
--------------------------------------------------------------------------------
  1833.8 ms - FastLED.h (SLOW)
  1062.2 ms - fl/task/executor.h (SLOW)
   679.4 ms - fl/task/scheduler.h (SLOW)
   669.3 ms - fl/stl/singleton.h (SLOW)
   668.5 ms - fl/stl/thread_local.h (SLOW)
   667.1 ms - fl/stl/thread.h (SLOW)
   667.0 ms - platforms/thread.h (SLOW)
   667.0 ms - platforms/stub/thread_stub.h (SLOW)
   666.9 ms - platforms/stub/thread_stub_stl.h (SLOW)
   496.6 ms - fl/fastled.h (SLOW)
   367.9 ms - fl/task/promise.h (SLOW)
   315.6 ms - fl/stl/function.h (SLOW)
   302.5 ms - crgb.h (SLOW)
   301.1 ms - fl/gfx/crgb.h (SLOW)
   296.0 ms - fl/math/ease.h (SLOW)
   293.6 ms - fl/math/fixed_point.h (SLOW)
   155.1 ms - fl/stl/shared_ptr.h (SLOW)
   144.0 ms - fl/math/fixed_point/s4x12.h (SLOW)
   141.7 ms - fl/stl/type_traits.h (SLOW)
   134.9 ms - fl/stl/move.h (SLOW)

FASTLED HEADERS (Nested Includes - Up to 10 Levels)
--------------------------------------------------------------------------------
FastLED.h (1833.8ms)
  ├─ 1062.2 ms - fl/task/executor.h
  │ ├─  679.4 ms - fl/task/scheduler.h
  │ │ ├─  669.3 ms - fl/stl/singleton.h
  │ │ │ └─  668.5 ms - fl/stl/thread_local.h
  │ │ │   └─  667.1 ms - fl/stl/thread.h
  │ │ │     └─  667.0 ms - platforms/thread.h
  │ │ │       └─  667.0 ms - platforms/stub/thread_stub.h
  │ │ │         └─  666.9 ms - platforms/stub/thread_stub_stl.h
  │ │ │           └─  633.5 ms - thread
  │ │ │             ├─  323.6 ms - std_thread.h
  │ │ │             └─  264.7 ms - this_thread_sleep.h
  │ │ └─    9.2 ms - fl/task/task.h
  │ │   └─    3.8 ms - fl/trace.h
  │ │     ├─    2.3 ms - fl/stl/chrono.h
  │ │     └─    1.1 ms - fl/stl/tuple.h
  │ ├─  367.9 ms - fl/task/promise.h
  │ │ ├─  315.6 ms - fl/stl/function.h
  │ │ │ ├─  155.1 ms - fl/stl/shared_ptr.h
  │ │ │ │ ├─  141.7 ms - fl/stl/type_traits.h
  │ │ │ │ │ └─  134.9 ms - fl/stl/move.h
  │ │ │ │ ├─    8.2 ms - fl/stl/atomic.h
  │ │ │ │ │ └─    7.2 ms - platforms/atomic.h
  │ │ │ │ │   └─    7.1 ms - platforms/shared/atomic.h
  │ │ │ │ └─    0.7 ms - fl/stl/bit_cast.h
  │ │ │ ├─  121.1 ms - fl/stl/vector.h
  │ │ │ │ ├─   84.1 ms - fl/math/math.h
  │ │ │ │ │ └─   78.0 ms - fl/stl/undef.h
  │ │ │ │ │   └─  152.8 ms - stdlib.h
  │ │ │ │ │     ├─   77.1 ms - cstdlib
  │ │ │ │ │     │ └─  152.8 ms - stdlib.h
  │ │ │ │ │     │   ├─   77.1 ms - cstdlib
  │ │ │ │ │     │   ├─   12.7 ms - types.h
  │ │ │ │ │     │   └─    0.6 ms - floatn.h
  │ │ │ │ │     ├─   12.7 ms - types.h
  │ │ │ │ │     │ ├─   12.7 ms - types.h
  │ │ │ │ │     │ │ ├─   12.7 ms - types.h
  │ │ │ │ │     │ │ ├─    2.6 ms - pthreadtypes.h
  │ │ │ │ │     │ │ ├─    2.1 ms - select.h
  │ │ │ │ │     │ │ └─    1.9 ms - endian.h
  │ │ │ │ │     │ ├─    2.6 ms - pthreadtypes.h
  │ │ │ │ │     │ │ └─    1.9 ms - thread-shared-types.h
  │ │ │ │ │     │ ├─    2.1 ms - select.h
  │ │ │ │ │     │ └─    1.9 ms - endian.h
  │ │ │ │ │     └─    0.6 ms - floatn.h
  │ │ │ │ ├─   19.6 ms - fl/stl/allocator.h
  │ │ │ │ │ └─   13.4 ms - fl/stl/bitset.h
  │ │ │ │ │   └─    8.7 ms - fl/stl/bitset_dynamic.h
  │ │ │ │ │     └─    2.3 ms - fl/stl/unique_ptr.h
  │ │ │ │ ├─    5.8 ms - fl/stl/initializer_list.h
  │ │ │ │ ├─    3.0 ms - fl/stl/basic_vector.h
  │ │ │ │ └─    0.7 ms - fl/stl/functional.h
  │ │ │ ├─   23.3 ms - fl/stl/variant.h
  │ │ │ │ └─   21.4 ms - fl/stl/new.h
  │ │ │ │   └─   21.4 ms - platforms/new.h
  │ │ │ │     └─   21.4 ms - platforms/shared/new.h
  │ │ │ │       └─   16.0 ms - new
  │ │ │ │         ├─    7.8 ms - c++config.h
  │ │ │ │         │ └─    6.1 ms - os_defines.h
  │ │ │ │         └─    0.6 ms - version.h
  │ │ │ ├─    5.2 ms - fl/stl/compiler_control.h
  │ │ │ └─    5.0 ms - fl/stl/algorithm.h
  │ │ │   └─    2.1 ms - fl/math/random.h
  │ │ │     └─    1.0 ms - fl/math/random8.h
  │ │ └─   46.9 ms - fl/stl/string.h
  │ │   ├─   13.8 ms - fl/stl/basic_string.h
  │ │   │ ├─    1.1 ms - fl/stl/not_null.h
  │ │   │ ├─    1.0 ms - fl/stl/iterator.h
  │ │   │ └─    0.6 ms - fl/stl/charconv.h
  │ │   ├─    9.3 ms - fl/stl/span.h
  │ │   │ └─    3.6 ms - fl/math/geometry.h
  │ │   ├─    5.8 ms - fl/stl/string_view.h
  │ │   └─    1.6 ms - fl/stl/optional.h
  │ ├─   12.4 ms - platforms/await.h
  │ │ └─   12.0 ms - platforms/coroutine_runtime.h
  │ │   └─   10.3 ms - fl/system/engine_events.h
  │ │     ├─    5.4 ms - fl/math/screenmap.h
  │ │     │ └─    4.0 ms - fl/stl/flat_map.h
  │ │     └─    3.3 ms - fl/math/xymap.h
  │ │       └─    0.8 ms - fl/math/lut.h
  │ └─    0.8 ms - fl/task/promise_result.h
  ├─  496.6 ms - fl/fastled.h
  │ ├─  302.5 ms - crgb.h
  │ │ ├─  301.1 ms - fl/gfx/crgb.h
  │ │ │ └─  296.0 ms - fl/math/ease.h
  │ │ │   └─  293.6 ms - fl/math/fixed_point.h
  │ │ │     ├─  144.0 ms - fl/math/fixed_point/s4x12.h
  │ │ │     │ ├─  122.8 ms - fl/math/sin32.h
  │ │ │     │ │ └─  119.5 ms - fl/math/simd.h
  │ │ │     │ │   └─  118.9 ms - fl/math/simd/types.h
  │ │ │     │ │     └─  118.7 ms - platforms/simd.h
  │ │ │     │ ├─    1.1 ms - fl/math/fixed_point/traits.h
  │ │ │     │ └─    0.8 ms - fl/math/fixed_point/isqrt.h
  │ │ │     ├─   18.9 ms - fl/math/fixed_point/s8x8.h
  │ │ │     ├─   18.7 ms - fl/math/fixed_point/s8x24.h
  │ │ │     ├─   18.5 ms - fl/math/fixed_point/s16x16.h
  │ │ │     └─   18.3 ms - fl/math/fixed_point/s24x8.h
  │ │ └─    0.9 ms - chsv.h
  │ │   └─    0.8 ms - fl/gfx/hsv.h
  │ ├─   83.1 ms - platforms.h
  │ │ └─   83.0 ms - platforms/stub/fastled_stub.h
  │ │   ├─   45.8 ms - platforms/stub/fastspi_stub.h
  │ │   │ └─   45.8 ms - platforms/stub/fastspi_stub_generic.h
  │ │   │   ├─   39.4 ms - platforms/shared/active_strip_data/active_strip_data.h
  │ │   │   │ └─   37.2 ms - fl/id_tracker.h
  │ │   │   │   └─   36.3 ms - fl/stl/mutex.h
  │ │   │   │     └─   36.2 ms - platforms/mutex.h
  │ │   │   │       └─   36.1 ms - platforms/stub/mutex_stub.h
  │ │   │   └─    6.0 ms - platforms/shared/active_strip_tracker/active_strip_tracker.h
  │ │   └─   37.1 ms - platforms/stub/clockless_stub.h
  │ │     └─   37.1 ms - platforms/stub/clockless_channel_stub.h
  │ │       ├─   13.2 ms - fl/system/log.h
  │ │       │ └─   12.8 ms - fl/stl/strstream.h
  │ │       ├─   13.0 ms - fl/channels/data.h
  │ │       │ └─    9.7 ms - fl/channels/config.h
  │ │       │   ├─    2.1 ms - fl/chipsets/chipset_timing_config.h
  │ │       │   │ └─    1.4 ms - fl/chipsets/led_timing.h
  │ │       │   └─    1.7 ms - fl/chipsets/spi.h
  │ │       ├─    2.4 ms - fl/channels/manager.h
  │ │       ├─    1.6 ms - fl/stl/weak_ptr.h
  │ │       └─    1.1 ms - fl/channels/driver.h
  │ ├─   42.0 ms - colorutils.h
  │ │ └─   41.2 ms - fl/gfx/colorutils.h
  │ │   ├─    8.9 ms - fl/gfx/blur.h
  │ │   │ └─    4.7 ms - fl/gfx/canvas.h
  │ │   │   └─    2.9 ms - fl/math/alpha.h
  │ │   └─    3.2 ms - fl/gfx/fill.h
  │ ├─   23.8 ms - pixel_controller.h
  │ │ ├─   17.2 ms - pixel_iterator.h
  │ │ │ └─   17.2 ms - fl/chipsets/encoders/pixel_iterator.h
  │ │ │   ├─    5.2 ms - fl/chipsets/encoders/apa102.h
  │ │ │   │ └─    4.0 ms - fl/chipsets/encoders/encoder_utils.h
  │ │ │   │   └─    3.3 ms - fl/gfx/gamma_lut.h
  │ │ │   ├─    4.4 ms - fl/chipsets/encoders/pixel_iterator_adapters.h
  │ │ │   ├─    1.0 ms - fl/chipsets/encoders/sk9822.h
  │ │ │   └─    0.9 ms - fl/chipsets/encoders/hd108.h
  │ │ └─    2.6 ms - rgbw.h
  │ │   └─    2.4 ms - fl/gfx/rgbw.h
  │ └─   22.8 ms - pixeltypes.h
  │   ├─   19.2 ms - lib8tion.h
  │   │ ├─    9.9 ms - fl/math/math8.h
  │   │ │ ├─    5.3 ms - fl/math/intmap.h
  │   │ │ │ └─    4.1 ms - platforms/intmap.h
  │   │ │ ├─    2.5 ms - fl/math/scale8.h
  │   │ │ │ └─    2.5 ms - platforms/scale8.h
  │   │ │ │   └─    1.0 ms - platforms/shared/scale8.h
  │   │ │ └─    2.1 ms - platforms/math8.h
  │   │ │   └─    1.6 ms - platforms/shared/math8.h
  │   │ ├─    2.0 ms - fl/math/beat.h
  │   │ │ └─    1.0 ms - fl/math/trig8.h
  │   │ │   └─    1.0 ms - platforms/trig8.h
  │   │ │     └─    0.9 ms - platforms/shared/trig8.h
  │   │ └─    0.5 ms - fl/math/qfx.h
  │   └─    3.2 ms - crgb.hpp
  ├─  130.0 ms - fl/ui.h
  │ ├─   80.5 ms - fl/stl/json.h
  │ │ └─   62.5 ms - fl/stl/json/types.h
  │ │   └─    8.0 ms - fl/stl/limits.h
  │ ├─   11.5 ms - fl/asset.h
  │ │ └─   10.2 ms - fl/stl/url.h
  │ └─   11.0 ms - fl/ui_impl.h
  │   └─   10.4 ms - platforms/ui_defs.h
  │     ├─    2.3 ms - platforms/shared/ui/json/audio.h
  │     │ └─    1.1 ms - platforms/shared/ui/json/audio_internal.h
  │     ├─    1.9 ms - platforms/shared/ui/json/button.h
  │     │ └─    0.8 ms - platforms/shared/ui/json/ui_internal.h
  │     ├─    1.0 ms - platforms/shared/ui/json/checkbox.h
  │     ├─    0.9 ms - platforms/shared/ui/json/help.h
  │     └─    0.9 ms - platforms/shared/ui/json/number_field.h
  ├─   45.9 ms - fl/stl/stdint.h
  │ └─   45.6 ms - platforms/int.h
  │   └─   45.1 ms - platforms/shared/int.h
  │     └─   45.0 ms - platforms/shared/int_linux.h
  └─   29.0 ms - chipsets.h
    ├─   11.8 ms - fl/chipsets/ucs7604.h
    │ └─    8.8 ms - fl/chipsets/encoders/ucs7604.h
    ├─    6.9 ms - fl/chipsets/apa102.h
    ├─    1.7 ms - fl/chipsets/lpd880x.h
    ├─    0.8 ms - fl/chipsets/p9813.h
    └─    0.8 ms - fl/chipsets/encoders/ws2816.h
fl/task/executor.h (1062.2ms)
  ├─  679.4 ms - fl/task/scheduler.h
  │ ├─  669.3 ms - fl/stl/singleton.h
  │ │ └─  668.5 ms - fl/stl/thread_local.h
  │ │   └─  667.1 ms - fl/stl/thread.h
  │ │     └─  667.0 ms - platforms/thread.h
  │ │       └─  667.0 ms - platforms/stub/thread_stub.h
  │ │         └─  666.9 ms - platforms/stub/thread_stub_stl.h
  │ │           └─  633.5 ms - thread
  │ │             ├─  323.6 ms - std_thread.h
  │ │             │ ├─   87.5 ms - tuple
  │ │             │ ├─   69.0 ms - refwrap.h
  │ │             │ ├─   33.4 ms - iosfwd
  │ │             │ ├─   13.0 ms - gthr.h
  │ │             │ └─    6.7 ms - unique_ptr.h
  │ │             └─  264.7 ms - this_thread_sleep.h
  │ │               ├─  246.2 ms - chrono.h
  │ │               └─    7.6 ms - cerrno
  │ └─    9.2 ms - fl/task/task.h
  │   └─    3.8 ms - fl/trace.h
  │     ├─    2.3 ms - fl/stl/chrono.h
  │     └─    1.1 ms - fl/stl/tuple.h
  ├─  367.9 ms - fl/task/promise.h
  │ ├─  315.6 ms - fl/stl/function.h
  │ │ ├─  155.1 ms - fl/stl/shared_ptr.h
  │ │ │ ├─  141.7 ms - fl/stl/type_traits.h
  │ │ │ │ └─  134.9 ms - fl/stl/move.h
  │ │ │ ├─    8.2 ms - fl/stl/atomic.h
  │ │ │ │ └─    7.2 ms - platforms/atomic.h
  │ │ │ │   └─    7.1 ms - platforms/shared/atomic.h
  │ │ │ └─    0.7 ms - fl/stl/bit_cast.h
  │ │ ├─  121.1 ms - fl/stl/vector.h
  │ │ │ ├─   84.1 ms - fl/math/math.h
  │ │ │ │ └─   78.0 ms - fl/stl/undef.h
  │ │ │ │   └─  152.8 ms - stdlib.h
  │ │ │ │     ├─   77.1 ms - cstdlib
  │ │ │ │     │ └─  152.8 ms - stdlib.h
  │ │ │ │     │   ├─   77.1 ms - cstdlib
  │ │ │ │     │   │ └─  152.8 ms - stdlib.h
  │ │ │ │     │   ├─   12.7 ms - types.h
  │ │ │ │     │   │ ├─   12.7 ms - types.h
  │ │ │ │     │   │ ├─    2.6 ms - pthreadtypes.h
  │ │ │ │     │   │ ├─    2.1 ms - select.h
  │ │ │ │     │   │ └─    1.9 ms - endian.h
  │ │ │ │     │   └─    0.6 ms - floatn.h
  │ │ │ │     ├─   12.7 ms - types.h
  │ │ │ │     │ ├─   12.7 ms - types.h
  │ │ │ │     │ │ ├─   12.7 ms - types.h
  │ │ │ │     │ │ │ ├─   12.7 ms - types.h
  │ │ │ │     │ │ │ ├─    2.6 ms - pthreadtypes.h
  │ │ │ │     │ │ │ ├─    2.1 ms - select.h
  │ │ │ │     │ │ │ └─    1.9 ms - endian.h
  │ │ │ │     │ │ ├─    2.6 ms - pthreadtypes.h
  │ │ │ │     │ │ │ └─    1.9 ms - thread-shared-types.h
  │ │ │ │     │ │ ├─    2.1 ms - select.h
  │ │ │ │     │ │ └─    1.9 ms - endian.h
  │ │ │ │     │ ├─    2.6 ms - pthreadtypes.h
  │ │ │ │     │ │ └─    1.9 ms - thread-shared-types.h
  │ │ │ │     │ ├─    2.1 ms - select.h
  │ │ │ │     │ └─    1.9 ms - endian.h
  │ │ │ │     └─    0.6 ms - floatn.h
  │ │ │ ├─   19.6 ms - fl/stl/allocator.h
  │ │ │ │ └─   13.4 ms - fl/stl/bitset.h
  │ │ │ │   └─    8.7 ms - fl/stl/bitset_dynamic.h
  │ │ │ │     └─    2.3 ms - fl/stl/unique_ptr.h
  │ │ │ ├─    5.8 ms - fl/stl/initializer_list.h
  │ │ │ ├─    3.0 ms - fl/stl/basic_vector.h
  │ │ │ └─    0.7 ms - fl/stl/functional.h
  │ │ ├─   23.3 ms - fl/stl/variant.h
  │ │ │ └─   21.4 ms - fl/stl/new.h
  │ │ │   └─   21.4 ms - platforms/new.h
  │ │ │     └─   21.4 ms - platforms/shared/new.h
  │ │ │       └─   16.0 ms - new
  │ │ │         ├─    7.8 ms - c++config.h
  │ │ │         │ └─    6.1 ms - os_defines.h
  │ │ │         │   └─    5.5 ms - features.h
  │ │ │         └─    0.6 ms - version.h
  │ │ ├─    5.2 ms - fl/stl/compiler_control.h
  │ │ └─    5.0 ms - fl/stl/algorithm.h
  │ │   └─    2.1 ms - fl/math/random.h
  │ │     └─    1.0 ms - fl/math/random8.h
  │ └─   46.9 ms - fl/stl/string.h
  │   ├─   13.8 ms - fl/stl/basic_string.h
  │   │ ├─    1.1 ms - fl/stl/not_null.h
  │   │ ├─    1.0 ms - fl/stl/iterator.h
  │   │ └─    0.6 ms - fl/stl/charconv.h
  │   ├─    9.3 ms - fl/stl/span.h
  │   │ └─    3.6 ms - fl/math/geometry.h
  │   ├─    5.8 ms - fl/stl/string_view.h
  │   └─    1.6 ms - fl/stl/optional.h
  ├─   12.4 ms - platforms/await.h
  │ └─   12.0 ms - platforms/coroutine_runtime.h
  │   └─   10.3 ms - fl/system/engine_events.h
  │     ├─    5.4 ms - fl/math/screenmap.h
  │     │ └─    4.0 ms - fl/stl/flat_map.h
  │     └─    3.3 ms - fl/math/xymap.h
  │       └─    0.8 ms - fl/math/lut.h
  └─    0.8 ms - fl/task/promise_result.h
fl/fastled.h (496.6ms)
  ├─  302.5 ms - crgb.h
  │ ├─  301.1 ms - fl/gfx/crgb.h
  │ │ └─  296.0 ms - fl/math/ease.h
  │ │   └─  293.6 ms - fl/math/fixed_point.h
  │ │     ├─  144.0 ms - fl/math/fixed_point/s4x12.h
  │ │     │ ├─  122.8 ms - fl/math/sin32.h
  │ │     │ │ └─  119.5 ms - fl/math/simd.h
  │ │     │ │   └─  118.9 ms - fl/math/simd/types.h
  │ │     │ │     └─  118.7 ms - platforms/simd.h
  │ │     │ │       └─  118.6 ms - platforms/shared/simd_x86.hpp
  │ │     │ ├─    1.1 ms - fl/math/fixed_point/traits.h
  │ │     │ └─    0.8 ms - fl/math/fixed_point/isqrt.h
  │ │     ├─   18.9 ms - fl/math/fixed_point/s8x8.h
  │ │     ├─   18.7 ms - fl/math/fixed_point/s8x24.h
  │ │     ├─   18.5 ms - fl/math/fixed_point/s16x16.h
  │ │     └─   18.3 ms - fl/math/fixed_point/s24x8.h
  │ └─    0.9 ms - chsv.h
  │   └─    0.8 ms - fl/gfx/hsv.h
  ├─   83.1 ms - platforms.h
  │ └─   83.0 ms - platforms/stub/fastled_stub.h
  │   ├─   45.8 ms - platforms/stub/fastspi_stub.h
  │   │ └─   45.8 ms - platforms/stub/fastspi_stub_generic.h
  │   │   ├─   39.4 ms - platforms/shared/active_strip_data/active_strip_data.h
  │   │   │ └─   37.2 ms - fl/id_tracker.h
  │   │   │   └─   36.3 ms - fl/stl/mutex.h
  │   │   │     └─   36.2 ms - platforms/mutex.h
  │   │   │       └─   36.1 ms - platforms/stub/mutex_stub.h
  │   │   │         └─   36.0 ms - platforms/stub/mutex_stub_stl.h
  │   │   └─    6.0 ms - platforms/shared/active_strip_tracker/active_strip_tracker.h
  │   └─   37.1 ms - platforms/stub/clockless_stub.h
  │     └─   37.1 ms - platforms/stub/clockless_channel_stub.h
  │       ├─   13.2 ms - fl/system/log.h
  │       │ └─   12.8 ms - fl/stl/strstream.h
  │       ├─   13.0 ms - fl/channels/data.h
  │       │ └─    9.7 ms - fl/channels/config.h
  │       │   ├─    2.1 ms - fl/chipsets/chipset_timing_config.h
  │       │   │ └─    1.4 ms - fl/chipsets/led_timing.h
  │       │   └─    1.7 ms - fl/chipsets/spi.h
  │       ├─    2.4 ms - fl/channels/manager.h
  │       ├─    1.6 ms - fl/stl/weak_ptr.h
  │       └─    1.1 ms - fl/channels/driver.h
  ├─   42.0 ms - colorutils.h
  │ └─   41.2 ms - fl/gfx/colorutils.h
  │   ├─    8.9 ms - fl/gfx/blur.h
  │   │ └─    4.7 ms - fl/gfx/canvas.h
  │   │   └─    2.9 ms - fl/math/alpha.h
  │   └─    3.2 ms - fl/gfx/fill.h
  ├─   23.8 ms - pixel_controller.h
  │ ├─   17.2 ms - pixel_iterator.h
  │ │ └─   17.2 ms - fl/chipsets/encoders/pixel_iterator.h
  │ │   ├─    5.2 ms - fl/chipsets/encoders/apa102.h
  │ │   │ └─    4.0 ms - fl/chipsets/encoders/encoder_utils.h
  │ │   │   └─    3.3 ms - fl/gfx/gamma_lut.h
  │ │   ├─    4.4 ms - fl/chipsets/encoders/pixel_iterator_adapters.h
  │ │   ├─    1.0 ms - fl/chipsets/encoders/sk9822.h
  │ │   └─    0.9 ms - fl/chipsets/encoders/hd108.h
  │ └─    2.6 ms - rgbw.h
  │   └─    2.4 ms - fl/gfx/rgbw.h
  └─   22.8 ms - pixeltypes.h
    ├─   19.2 ms - lib8tion.h
    │ ├─    9.9 ms - fl/math/math8.h
    │ │ ├─    5.3 ms - fl/math/intmap.h
    │ │ │ └─    4.1 ms - platforms/intmap.h
    │ │ ├─    2.5 ms - fl/math/scale8.h
    │ │ │ └─    2.5 ms - platforms/scale8.h
    │ │ │   └─    1.0 ms - platforms/shared/scale8.h
    │ │ └─    2.1 ms - platforms/math8.h
    │ │   └─    1.6 ms - platforms/shared/math8.h
    │ ├─    2.0 ms - fl/math/beat.h
    │ │ └─    1.0 ms - fl/math/trig8.h
    │ │   └─    1.0 ms - platforms/trig8.h
    │ │     └─    0.9 ms - platforms/shared/trig8.h
    │ └─    0.5 ms - fl/math/qfx.h
    └─    3.2 ms - crgb.hpp
fl/ui.h (130.0ms)
  ├─   80.5 ms - fl/stl/json.h
  │ └─   62.5 ms - fl/stl/json/types.h
  │   └─    8.0 ms - fl/stl/limits.h
  ├─   11.5 ms - fl/asset.h
  │ └─   10.2 ms - fl/stl/url.h
  └─   11.0 ms - fl/ui_impl.h
    └─   10.4 ms - platforms/ui_defs.h
      ├─    2.3 ms - platforms/shared/ui/json/audio.h
      │ └─    1.1 ms - platforms/shared/ui/json/audio_internal.h
      ├─    1.9 ms - platforms/shared/ui/json/button.h
      │ └─    0.8 ms - platforms/shared/ui/json/ui_internal.h
      ├─    1.0 ms - platforms/shared/ui/json/checkbox.h
      ├─    0.9 ms - platforms/shared/ui/json/help.h
      └─    0.9 ms - platforms/shared/ui/json/number_field.h
fl/stl/stdint.h (45.9ms)
  └─   45.6 ms - platforms/int.h
    └─   45.1 ms - platforms/shared/int.h
      └─   45.0 ms - platforms/shared/int_linux.h

TOP 20 SLOWEST OPERATIONS
--------------------------------------------------------------------------------
  1.  1833.8 ms - Source: FastLED.h
  2.  1833.8 ms - Total Source: 
  3.  1062.2 ms - Source: fl/task/executor.h
  4.   679.4 ms - Source: fl/task/scheduler.h
  5.   669.3 ms - Source: fl/stl/singleton.h
  6.   669.3 ms - Total ParseClass: 
  7.   668.5 ms - Source: fl/stl/thread_local.h
  8.   667.1 ms - Source: fl/stl/thread.h
  9.   667.0 ms - Source: platforms/thread.h
 10.   667.0 ms - Source: platforms/stub/thread_stub.h
 11.   666.9 ms - Source: platforms/stub/thread_stub_stl.h
 12.   633.5 ms - Source: thread
 13.   496.6 ms - Source: fl/fastled.h
 14.   367.9 ms - Source: fl/task/promise.h
 15.   323.6 ms - Source: std_thread.h
 16.   315.6 ms - Source: fl/stl/function.h
 17.   302.5 ms - Source: crgb.h
 18.   301.1 ms - Source: fl/gfx/crgb.h
 19.   296.0 ms - Source: fl/math/ease.h
 20.   293.6 ms - Source: fl/math/fixed_point.h

PERFORMANCE FLAGS
--------------------------------------------------------------------------------
⚠️  SLOW HEADERS (>50.0ms):
    - FastLED.h (1833.8ms)
    - fl/task/executor.h (1062.2ms)
    - fl/task/scheduler.h (679.4ms)
    - fl/stl/singleton.h (669.3ms)
    - fl/stl/thread_local.h (668.5ms)
    - fl/stl/thread.h (667.1ms)
    - platforms/thread.h (667.0ms)
    - platforms/stub/thread_stub.h (667.0ms)
    - platforms/stub/thread_stub_stl.h (666.9ms)
    - fl/fastled.h (496.6ms)

⚠️  Template instantiation time is high (26.3% of total)
✓  Lexing time is acceptable (<10% of total)

RECOMMENDATIONS
--------------------------------------------------------------------------------
1. Consider optimizing FastLED.h (1833.8ms)
2. Consider optimizing fl/task/executor.h (1062.2ms)
3. Consider optimizing fl/task/scheduler.h (679.4ms)

================================================================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant