Skip to content

perf(size): stop monomorphizing fbuild-packages-fetch per caller - #1847

Merged
zackees merged 3 commits into
mainfrom
perf/packages-fetch-monomorph
Nov 1, 2026
Merged

zackees merged 3 commits into
mainfrom
perf/packages-fetch-monomorph

Conversation

@zackees

@zackees zackees commented Nov 1, 2026

Copy link
Copy Markdown
Member

Behaviour-preserving size refactor.

  • PackageBase::staged_install<F> is now a thin generic shim: it boxes validate into Box<dyn FnOnce> and awaits a Pin<Box<dyn Future + Send>> built by a non-generic helper around the single body.
  • downloader::download_file and RegistryClient::resolve_cached await a boxed dyn Future from an #[inline(never)] helper.

Root cause: the async state machines, and everything they await (prepare_submodules, download_file_with_progress_named, resolve_candidates, ...), were copied into every caller's codegen unit. The generic closure parameter and cross-crate inlining both caused this. Public signatures are unchanged.

Measurement

CARGO_PROFILE_RELEASE_STRIP=none soldr cargo build --release -p fbuild-daemon, then nm -S -C | grep fbuild_packages_fetch:

symbols bytes
before 4091 5,695,405
after 1259 929,730

Symbol counts: staged_install 319->43, download_file_with_progress_named 141->3, prepare_submodules 154->5, resolve_candidates 114->4.
fbuild-daemon binary (unstripped): 73,493,208 -> 64,913,616 B (-8.58 MB, -11.7%).

Tests

  • soldr cargo clippy --workspace --all-targets -- -D warnings: clean
  • bash test -p fbuild-packages-fetch: 250 passed, 0 failed

Type-erase staged_install's validate closure and box the install,
download_file and resolve_cached futures behind non-inline helpers so
their state machines (and everything they await) compile once instead
of once per caller. Behaviour unchanged.

fbuild-daemon release (unstripped): fbuild_packages_fetch symbols
5,695,405 B / 4091 syms -> 929,730 B / 1259 syms; binary 73.49 MB -> 64.91 MB.
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@zackees
zackees added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit 199a288 Nov 1, 2026
28 checks passed
zackees added a commit that referenced this pull request Nov 1, 2026
Clears BEHIND/DIRTY after main advanced to a80996a (#1847, #1848).
Single conflict: the generated ci/platform_boundary_research.tsv, resolved
by regenerating it with ci/platform_boundary_research.py --write against
the merged tree (--check rc0, boundary totals 44/43).
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 2, 2026
@zackees
zackees deleted the perf/packages-fetch-monomorph branch November 5, 2026 05:51
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