Repository navigation
Description
Summary
FastLED's ./compile wrapper (via ci/ci-compile.py) currently invokes fbuild deploy once per example in a loop. On GitHub Actions the loop is forced serial by ci/util/cpu_count.py:7-8:
def cpu_count() -> int:
if "GITHUB_ACTIONS" in os.environ:
return 1
...That short-circuit dates back to PlatformIO, where each pio run cost hundreds of MB and two concurrent invocations on a 2-core runner risked OOM. Under fbuild's daemon model that constraint no longer applies, but the loop itself is still single-threaded — and it pays the per-invocation fbuild startup cost (toolchain load, LDF process startup) ~80 times per board.
A new fbuild primitive (fbuild compile-many, tracked in FastLED/fbuild#238) folds the entire "build framework once, fan sketches out in parallel" pipeline into a single process:
fbuild compile-many --board <board> \
--framework-jobs 1 \
--sketch-jobs 2 \
<sketch1> <sketch2> ...
This issue tracks switching FastLED's ./compile to consume that primitive when it ships, so the CI matrix gets the speedup automatically.
Why this is a separate ticket from the fbuild work
fbuild is upstream of FastLED. FastLED/fbuild#238 builds the primitive in fbuild and proves it on the upstream benchmark workflow (FastLED/fbuild's bench/fastled-examples branch). Once that primitive lands and a fbuild release ships, this ticket is the downstream consumer change — small, local to ci/, and unblocks the same speedup for FastLED's own CI.
Expected savings on build_*.yml workflows
Based on FastLED/fbuild#112 iter7 measurements (board=uno, ~80 examples):
| current state | with compile-many 2-wide stage 2 |
with compile-many 4-wide |
|---|---|---|
| compile phase ≈ 136 s | ~73 s (-46 %) | ~42 s (-69 %) on bigger runners |
Every build_* workflow that compiles the example set benefits proportionally. On 2-core ubuntu-latest the realistic gain is ~60 s per board × ~20 boards = ~20 minutes of total CI time saved per push to master.
Plan
- Wait for feat(cli): two-stage compile-many primitive — framework once, sketches in parallel (#112) fbuild#238 to land + a fbuild release that exposes
compile-many. - Bump the pinned
fbuildversion inpyproject.toml. - In
ci/ci-compile.py, replace the per-example loop with a singlefbuild compile-manycall. Wire--framework-jobsand--sketch-jobsto env vars (FASTLED_FRAMEWORK_JOBS,FASTLED_SKETCH_JOBS) with sensible defaults:framework-jobs = 1,sketch-jobs = min(cpu_count, 2)on Actions, fullcpu_countelsewhere. - Delete the
GITHUB_ACTIONS → 1short-circuit inci/util/cpu_count.py. The new path uses fbuild's own scheduler; the wrapper no longer needs to police per-job memory pressure. - Run all
build_*.ymlworkflows to confirm no regression in pass/fail or per-example output. Record before/after timings onbuild_uno.ymlas the canonical comparison.
Acceptance
./compile <board> <examples>works end-to-end viacompile-many, no behavioral change vs the old loop.build_uno.ymlcompile phase drops by ≥ 40 % onubuntu-latest(per [META] Fastest possible FastLED examples CI rebuild — profile + benchmark fbuild#112 iter7 expectations).- No new flakiness in board CI (per-board success rate on master matches pre-switch baseline over 10 consecutive runs).
ci/util/cpu_count.pyno longer has theGITHUB_ACTIONSshort-circuit, or has it gated behind a different (justified) constraint.
Out of scope
- Anything that changes fbuild itself. That's all feat(cli): two-stage compile-many primitive — framework once, sketches in parallel (#112) fbuild#238.
- Caching
fastled/.venvacross CI runs. Tracked as bench iter8b: cache fastled/.venv across runs (#112) — uv_sync 22s → <5s on warm fbuild#239 on the upstream side; the benefit there is benchmark-specific. - Migrating away from
./compileas the CI entry point. The wrapper stays; only its internals swap.
Related
- feat(cli): two-stage compile-many primitive — framework once, sketches in parallel (#112) fbuild#238 — upstream primitive this consumes.
- [META] Fastest possible FastLED examples CI rebuild — profile + benchmark fbuild#112 — upstream meta tracker for CI-speed work (where the iter7 baseline numbers come from).
- bench iter8b: cache fastled/.venv across runs (#112) — uv_sync 22s → <5s on warm fbuild#239 — independent
.venvcaching on the upstream bench; stacks but lives upstream.
Activity