perf(install): mtime-skip fast path + structured artifact discovery#6
Merged
Merged
Conversation
… items 6+8) Two upgrades to `ci/build_wheel.py` ported from FastLED/fbuild#743. 1. mtime-skip fast path. `_staged_binary_is_up_to_date()` walks the workspace's cargo inputs (Cargo.toml, Cargo.lock, rust-toolchain.toml, crates/**/Cargo.toml, crates/**/*.rs) and compares each st_mtime against the staged `src/template_python_rust_cmd/_bin/template-cli`. If staged is newer, skip cargo entirely — `_ensure_staged_cli_binary()` returns the already-staged file. Triggered on no-op reinstalls (version bumps, lockfile churn, --reinstall-package). Even cargo's "Fresh" pass walks the workspace and burns wall-clock seconds; an mtime check is milliseconds. fbuild measured 14.9s → 1.1s on its forced reinstall path. 2. Structured artifact discovery. `build_cli_binary()` now invokes cargo with `--message-format=json-render-diagnostics` and walks the JSON artifact stream for `reason == "compiler-artifact"` + `target.name == "template-cli"` + non-null `executable`. Fallback: `_find_cli_executable_by_search()` probes the target root (respecting CARGO_TARGET_DIR) and every per-host-triple subdir for cases where cargo emits no compiler-artifact line (fully cached `Fresh` runs) or where the build is configured with a host triple (CARGO_BUILD_TARGET). Replaces the previous hardcoded `target/release/template-cli` path, which would have masked the pinned CARGO_TARGET_DIR landed in the previous PR. Refs #2 (items 6 + 8). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two upgrades to
ci/build_wheel.pyported from fbuild#743.mtime-skip — Walk cargo inputs (Cargo.toml/.lock, rust-toolchain.toml, crates//Cargo.toml, crates//*.rs) and compare each st_mtime against the staged
_bin/template-cli. If staged is newer, skip cargo entirely. fbuild measured 14.9s → 1.1s on no-source-change reinstall.Structured artifact discovery — Invoke cargo with
--message-format=json-render-diagnosticsand walk the JSON forreason == "compiler-artifact"+target.name == "template-cli". Filesystem fallback respectsCARGO_TARGET_DIR(pinned in the previous PR) and per-host-triple subdirs, so a fully-cachedFreshbuild that emits no artifact line is still discoverable.Refs #2 — items (6) + (8).
Test plan
python -c "import ast; ast.parse(open('ci/build_wheel.py').read())"clean.🤖 Generated with Claude Code