From 3dc7c184eebf355a0fb0345321ad265e9c30ef81 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Sun, 6 Sep 2026 20:17:53 +0200 Subject: [PATCH] Optimise for release only, since every edit pays for a dev build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dependencies were built at `opt-level = 2` even in dev, because wgpu and image decoding are slow without it. That is still true, and it is what this gives up: a debug run of the app, and the decode- and GPU-heavy tests, are slower than they were. What it buys is that nothing has to be optimised before it can be compiled. That cost was paid on every edit, in every worktree, whether or not anything was ever run — and there are sixteen worktrees, each with its own target directory and no shared cache, so it was paid sixteen times over. `[profile.release]` is untouched: `lto = "thin"` and `codegen-units = 1` still apply where the speed is actually wanted. If one crate turns out to be the one that makes a test unbearable, raise that crate alone rather than restoring the blanket rule; the manifest says how. Incremental compilation is now on as well, but that lives in `.cargo/config.toml`, which is untracked and per-checkout — so it is a local change on this machine, not part of this commit. --- Cargo.toml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 46bbd85..ad8e272 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -233,13 +233,25 @@ ort-tract = "0.4" ndarray = "0.17" [profile.dev] -# Dependencies optimised even in dev builds — wgpu and image decoding are -# unusably slow otherwise, and they rarely need debugging. +# Dev builds are tuned for how fast they *compile*, not for how fast they run. +# Optimisation is a release concern; `[profile.release]` below is where it +# belongs. +# +# This deliberately reverses an earlier choice. Dependencies used to be built +# at `opt-level = 2` here, because wgpu and image decoding are slow without it. +# That is still true, and it is the price: a debug run of the app, and the +# decode- and GPU-heavy tests, are slower than they were. What it buys is that +# nothing has to be optimised before it can be compiled — which is the cost +# paid on every edit, by every worktree, rather than only when something is +# actually run. +# +# If a particular crate turns out to be the one that makes a test unbearable, +# raise it alone rather than restoring the blanket rule: +# +# [profile.dev.package.zune-jpeg] +# opt-level = 2 opt-level = 0 -[profile.dev.package."*"] -opt-level = 2 - [profile.release] lto = "thin" codegen-units = 1