Skip to content

perf(install): mtime-skip fast path + structured artifact discovery#6

Merged
zackees merged 1 commit into
mainfrom
perf/mtime-skip-and-artifact-discovery
Jun 22, 2026
Merged

perf(install): mtime-skip fast path + structured artifact discovery#6
zackees merged 1 commit into
mainfrom
perf/mtime-skip-and-artifact-discovery

Conversation

@zackees

@zackees zackees commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

Two upgrades to ci/build_wheel.py ported from fbuild#743.

  1. 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.

  2. Structured artifact discovery — Invoke cargo with --message-format=json-render-diagnostics and walk the JSON for reason == "compiler-artifact" + target.name == "template-cli". Filesystem fallback respects CARGO_TARGET_DIR (pinned in the previous PR) and per-host-triple subdirs, so a fully-cached Fresh build 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.
  • CI green.

🤖 Generated with Claude Code

… 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>
@zackees zackees merged commit 9010e7e into main Jun 22, 2026
@zackees zackees deleted the perf/mtime-skip-and-artifact-discovery branch June 22, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant