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
PlatformIO (SCons) builds every translation unit (libraries, framework libraries, core, sketch) as nodes of one dependency graph at -j N, so any ready compile runs. fbuild's ESP32 orchestrator (crates/fbuild-build-esp/src/esp32/orchestrator/build.rs) runs them as serial stages. Each stage ends with a partly idle tail, and the next stage cannot start until it finishes.
one library at a time; must finish before core starts
7
Core + sketch (750–776)
the only stage already on a shared pool (#1545), with boot artifacts overlapped (#1548)
8
Local lib/ libraries (826)
runs after core/sketch, not alongside
9
embed_files (851), compile DB (867)
small, serial before link
10
Link → convert/size
matches PlatformIO (the link must wait)
bench/blink has no libraries, so stages 2–6 and 8 are empty and the benchmark does not show this. A FastLED project pays for all of it on every cold build: ~30 FastLED unity TUs one library at a time, then 5 framework libraries one at a time, then core + sketch.
Proposal
Extend the #1545 pattern (compile_phases::compile_core_and_sketch with one Arc<Semaphore>) to the whole build:
Resolve first, compile later. Collect every library's sources and include dirs (lib_deps, project-as-lib, LDF-selected framework libs, local libs), then run library selection on sources. It does not need lib_deps objects.
Archive per library as soon as its objects are done. Each archive depends only on its own objects. The link waits on all archives, the core objects and the sketch.
Remove the per-library for loops in library_manager.rs and framework_libs.rs, or turn them into producers that feed the pool.
Small items: run the toolchain and framework ensure_installed concurrently, and cache the gcc --version probe per toolchain path.
Correctness constraints to keep:
Per-library flags and include dirs, and library.json build flags.
Library-selection shadowing rules.
Archive order on the link line.
.cmdhash rebuild signatures.
Fail-fast on the first compile error, with the join/drain soundness in parallel.rs.
Expected impact
For FastLED sketches on ESP32, the cold build should approach one parallel phase bounded by (total TU CPU ÷ cores). Today it is the sum of each stage's makespan plus its idle tail. For blink, nothing changes.
Acceptance
A FastLED example cold build (e.g. DemoReel100, esp32s3) with FBUILD_PERF_LOG_JSON shows a single compile phase, and a process sampler shows ≥ N-1 compilers busy throughout.
Problem
PlatformIO (SCons) builds every translation unit (libraries, framework libraries, core, sketch) as nodes of one dependency graph at
-j N, so any ready compile runs. fbuild's ESP32 orchestrator (crates/fbuild-build-esp/src/esp32/orchestrator/build.rs) runs them as serial stages. Each stage ends with a partly idle tail, and the next stage cannot start until it finishes.main)log_toolchain_version(229, 240, 249)gcc --versionevery buildlib_depscompile,ensure_libraries(388)library_manager.rs:130for lib in &installedlib_depssources, not objectsframework_libs.rs:136loop)lib/libraries (826)embed_files(851), compile DB (867)bench/blinkhas no libraries, so stages 2–6 and 8 are empty and the benchmark does not show this. A FastLED project pays for all of it on every cold build: ~30 FastLED unity TUs one library at a time, then 5 framework libraries one at a time, then core + sketch.Proposal
Extend the #1545 pattern (
compile_phases::compile_core_and_sketchwith oneArc<Semaphore>) to the whole build:lib_deps, project-as-lib, LDF-selected framework libs, local libs), then run library selection on sources. It does not needlib_depsobjects.dispatch_rank(C++ first, perf(build): dispatch C++ translation units before C and assembly #1553/fix(build): take compile permits in dispatch order #1558). Within that, put the longest TUs first, e.g. the FastLED unity files.forloops inlibrary_manager.rsandframework_libs.rs, or turn them into producers that feed the pool.ensure_installedconcurrently, and cache thegcc --versionprobe per toolchain path.Correctness constraints to keep:
library.jsonbuild flags..cmdhashrebuild signatures.parallel.rs.Expected impact
For FastLED sketches on ESP32, the cold build should approach one parallel phase bounded by (total TU CPU ÷ cores). Today it is the sum of each stage's makespan plus its idle tail. For blink, nothing changes.
Acceptance
DemoReel100, esp32s3) withFBUILD_PERF_LOG_JSONshows a single compile phase, and a process sampler shows ≥ N-1 compilers busy throughout.pio run -vbreakdown (bench: break PlatformIO cold builds into phases for A/B with fbuild #1557).Follow-up to #1537.