Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,14 @@ impl Step {
const BENCH_VALIDATE: Self = Self {
name: "bench (validate)",
run: || {
// Use the dev profile (not the default bench profile) for the
// criterion `--test` smoke run. The bench profile inherits the
// release profile's `lto = true, codegen-units = 1`, which spends
// ~40s compiling the full graph just to assert criterion's
// `--test` entry point runs once. The dev profile reuses the
// already-built unit-test artifacts and finishes in seconds. Real
// benchmark measurements (via `cargo xtask bench`) continue to
// use the unchanged bench profile so their numbers stay accurate.
run_command_quiet(
"cargo",
&[
Expand All @@ -575,6 +583,7 @@ impl Step {
"microsoft-webui",
"--bench",
"contact_book_bench",
"--profile=dev",
"--",
"--test",
],
Expand Down
18 changes: 18 additions & 0 deletions xtask/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,25 @@ pub fn run_command_quiet(cmd: &str, args: &[&str], cwd: Option<&Path>) -> Result
/// On Windows `CreateProcessW` cannot launch `.cmd`/`.bat` scripts directly.
/// This function uses `which` to resolve the executable path and, when the
/// target is a shell script, wraps it in `cmd.exe /c <resolved_path>`.
///
/// For cargo invocations, this also forces `CARGO_INCREMENTAL=0`. xtask is
/// only used for one-shot work (gate, examples, bench, packaging, E2E) and
/// never for an inner edit-compile loop, so incremental compilation provides
/// no benefit. Leaving it on causes the workspace `target/` dir to balloon
/// (the incremental cache and per-feature fingerprint variants grow into the
/// tens of gigabytes), which then makes every subsequent cargo invocation pay
/// huge startup time scanning hundreds of thousands of stale fingerprint
/// files. Disabling it here keeps `cargo xtask check` reliably fast on
/// long-lived working copies.
pub fn build_command(cmd: &str, args: &[&str]) -> Command {
let mut command = build_command_inner(cmd, args);
if cmd == "cargo" {
command.env("CARGO_INCREMENTAL", "0");
}
command
}

fn build_command_inner(cmd: &str, args: &[&str]) -> Command {
#[cfg(windows)]
{
resolve_windows_command(cmd, args)
Expand Down
Loading