Skip to content

perf: task scheduler, EngineEvents and coroutine runtime linked unconditionally (~2.5-3.5 KB, ~420 B RAM) #4797

Closed

Description

@zackees

Problem

Blink and APA102 never schedule tasks, but every ESP32 sketch links the task scheduler, EngineEvents and the coroutine runtime:

  • Scheduler: task::Scheduler::update_tasks_of_type 202, update 184, vector<task::Handle> 176, task::run 158 (about 1.8 KB total).
  • EngineEvents: RAM Singleton<EngineEvents>::storage 160 and Singleton<task::Scheduler>::storage 112.
  • Coroutine runtime: CoroutineRuntimeEsp32/ICoroutineRuntime vtables, and CountingSemaphoreESP32<1> acquire/release/ctor (about 0.7 KB on S3).
  • Total: about 2.5–3.5 KB flash and about 420 B RAM per ESP32 sketch. Teensy carries EngineEvents too.

Proposed fix

Make FastLED.show() / delay() reach the scheduler only through a hook that the first fl::task / async / coroutine use installs, so sketches that never create a task don't link it.

Acceptance

  • Scheduler and coroutine symbols are absent from Blink and APA102 maps on ESP32.
  • Task, async and coroutine tests and examples are unchanged.

Data: https://fastled.github.io/dashboard/ (master 18669e6 vs 3.10.3, fbuild 2.5.38), symbol-level bloat reports linked from each dashboard point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreplatform: esp32priority: mediumtype: regression

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions