From 7e9768f07b94db63636d2bbabc75739437e2fa8c Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 11 Nov 2026 17:31:58 +0000 Subject: [PATCH] Dev profile: craft-ui-contract at opt-level 0 An edit to the runtime's 65k lines spent 35-90 s in opt-level 1 codegen before its test binary linked. The hot pipeline is generic and compiles in the dependants anyway; theme, behavior and proof stay at opt-level 1. --- Cargo.toml | 12 +++++------- docs/development.md | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d6ff48c3c..cd70743ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -239,13 +239,11 @@ lto = "off" [profile.dev.package."*"] opt-level = 2 -# The workspace crates whose code runs in every screen-test frame (the framework runtime, the theme's colour maths -# and the behaviour cores), and craft-proof, whose tests parse and check whole dictionaries, build at opt-level 1: -# unoptimised, they made the test binaries several times slower. The crates above the runtime (widgets, panels, -# canvas, patterns, shell) stay at opt-level 0: their code is a few percent of a frame, and at opt-level 0 a one-line -# edit rebuilds in seconds instead of the better part of a minute. -[profile.dev.package.craft-ui-contract] -opt-level = 1 +# craft-theme's colour maths and the behaviour cores, which run in every screen-test frame, and craft-proof, whose +# tests parse and check whole dictionaries, build at opt-level 1: unoptimised, they made the test binaries several +# times slower, and they are rarely edited. Every other workspace crate, the framework runtime included, stays at +# opt-level 0: an edit to craft-ui-contract (65k lines) rebuilt for 35-90 s at opt-level 1 and rebuilds in seconds at 0, +# and the runtime's hot pipeline is generic, so it compiles in the dependants at their opt-level anyway. [profile.dev.package.craft-theme] opt-level = 1 [profile.dev.package.craft-behavior] diff --git a/docs/development.md b/docs/development.md index 61b40cc76..69e10a7e5 100644 --- a/docs/development.md +++ b/docs/development.md @@ -49,7 +49,7 @@ No workflow runs the tests of: craft-behavior, craft-host and craft-ui-macros; t - Dependencies build at `opt-level = 2` in dev and test builds, once per target directory, so screen tests and the debug gallery run at a usable speed. - `lto = "off"` in dev: with cargo's default (`lto = false`) rustc runs thin-local LTO across every optimised crate's codegen units on each rebuild; off, a one-line edit re-optimises only the changed units (widgets' one-line rebuild went from 41 s to 4 s). -- craft-ui-contract, craft-theme, craft-behavior and craft-proof build at `opt-level = 1`: the runtime is where a screen-test frame spends its time. Everything above the runtime (widgets, panels, canvas, patterns, shell, the domain crates) builds at 0, where rustc shares generic instantiations across crates and an edit rebuilds in seconds. +- craft-theme, craft-behavior and craft-proof build at `opt-level = 1`: their code runs in every screen-test frame (colour maths, behaviour cores) or in dictionary-sized tests, and they are rarely edited. Every other workspace crate, the runtime (craft-ui-contract) included, builds at 0, where rustc shares generic instantiations across crates and an edit rebuilds in seconds (the runtime's 65k lines cost 35–90 s of codegen per edit at opt-level 1). - The `gallery` profile (the owner's native gallery): release optimisation, incremental, 256 codegen units, and the workspace's own crates at `opt-level = 1`, which keeps rustc sharing generics across crates so a framework edit does not re-generate every dependant's copies; dependencies keep `opt-level = 3`. ## The job pool