Skip to content

perf(pipeline): compile lib_deps and project-as-library in the shared job pool - #1562

Merged
zackees merged 1 commit into
mainfrom
perf/pipeline-libdeps-shared-gate
Sep 28, 2026
Merged

zackees merged 1 commit into
mainfrom
perf/pipeline-libdeps-shared-gate

Conversation

@zackees

@zackees zackees commented Sep 28, 2026

Copy link
Copy Markdown
Member

Part of #1559, the second of three PRs. It builds on #1561 and applies to every shared-pipeline platform: AVR, the ARM families (Teensy, RP2040, STM32 incl. Arduino-mbed, nRF52, SAM, Renesas, Apollo3, SiLabs, NXP LPC), ESP8266 and CH32V.

Problem

Each shared-pipeline orchestrator ran resolve_lib_deps, which installed and compiled every lib_deps library (one at a time until #1561) before the core's compiler even existed. run_sequential_build_with_libs then compiled the project-as-library archive after the core/sketch/local-lib join. Each of those stages used a pool of its own.

Fix

  • resolve_lib_deps now only installs libraries and folds their include dirs into the list. It returns a deferred LibDeps, and no longer takes a jobs argument. ensure_lib_deps is removed.
  • run_sequential_build_with_libs(..., extra_link_inputs, lib_deps: LibDeps, ...) compiles lib_deps and the project-as-library archive on its single compile_slots gate. They run in the same tokio::join! as core, variant, sketch and local libs, and it stays join!, never try_join!, so every branch is awaited.
  • compile_project_as_library takes the gate.
  • Link order is unchanged: extra inputs, then lib_deps archives, then the project archive. RP2040 and NXP LPC used to append the library archives to their own support inputs; those now pass their inputs as extra_link_inputs, and the pipeline appends the library archives after them, which gives the same order.
  • New perf phases: compile-lib-deps and project-as-lib. Both overlap the core compile in wall time.
  • ESP32 only passes a gate to compile_project_as_library here; PR3 moves ESP32 onto the one shared gate.

Tests

lib_deps_and_core_share_one_job_gate builds two real symlink:// libraries through resolve_lib_deps with fake toolchain scripts, and runs a core compile on the same job_gate(2). It asserts:

  • never more than 2 compiles in flight;
  • the library compiles overlap the core compile;
  • both archives are produced.

It passed 50 of 50 runs.

fbuild-build-engine 473, -mcu 77, -arm 228, -esp 137 tests pass. Workspace clippy is clean.

Light end-to-end

project result
AVR uno + FastLED=symlink:// builds, firmware.hex 14.22 KB (identical to before)
bench/blink -e uno builds, 2.55 KB
ESP32-S3 FastLED DemoReel100 (sanity) builds, same 692.64 KB image

Cold before/after timings come at the end of #1559.

… job pool

Every shared-pipeline platform (AVR, ARM families, RP2040, ESP8266,
CH32V, ...) compiled lib_deps to completion -- one library at a time --
before the compiler for the core even existed, and compiled the
project-as-library archive after the core/sketch join, each on a pool
of its own. resolve_lib_deps now only installs libraries and folds in
their include dirs, returning a deferred LibDeps; the sequential
pipeline compiles it and the project-as-library archive on the same
compile_slots gate, joined with core, variant, sketch and local libs.
Link order is unchanged (extra inputs, lib_deps archives, project
archive). ensure_lib_deps is gone.

Test: lib_deps_and_core_share_one_job_gate (two real local libraries
plus a core compile on one 2-permit gate: never more than 2 in flight,
library compiles overlap the core, archives produced).

Part of #1559.
@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: FastLED/fbuild/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: cb8a0804-980d-47e9-9b1e-a18b854d4ea5

📥 Commits

Reviewing files that changed from the base of the PR and between dba88ca and aaf4310.

📒 Files selected for processing (18)
  • crates/fbuild-build-arm/src/apollo3/orchestrator.rs
  • crates/fbuild-build-arm/src/nrf52/orchestrator.rs
  • crates/fbuild-build-arm/src/nxplpc/orchestrator.rs
  • crates/fbuild-build-arm/src/renesas/orchestrator.rs
  • crates/fbuild-build-arm/src/rp2040/orchestrator.rs
  • crates/fbuild-build-arm/src/sam/orchestrator.rs
  • crates/fbuild-build-arm/src/silabs/orchestrator.rs
  • crates/fbuild-build-arm/src/stm32/orchestrator/arduino_mbed.rs
  • crates/fbuild-build-arm/src/stm32/orchestrator/mod.rs
  • crates/fbuild-build-arm/src/teensy/orchestrator.rs
  • crates/fbuild-build-engine/src/pipeline/library.rs
  • crates/fbuild-build-engine/src/pipeline/library_shared_gate_tests.rs
  • crates/fbuild-build-engine/src/pipeline/mod.rs
  • crates/fbuild-build-engine/src/pipeline/sequential.rs
  • crates/fbuild-build-esp/src/esp32/orchestrator/build.rs
  • crates/fbuild-build-esp/src/esp8266/orchestrator.rs
  • crates/fbuild-build-mcu/src/avr/orchestrator.rs
  • crates/fbuild-build-mcu/src/ch32v/orchestrator.rs

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.

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

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant