From 7cbc2b85e3944e3317f668f2b3ca553869390e91 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Wed, 18 Nov 2026 14:13:03 +0700 Subject: [PATCH] Build the craft UI framework below opt-level 2 in test builds (#15565) * Build the craft UI framework at craft-libs' optimization levels in test builds The test profile compiled the craft facade and its framework crates at the opt-level 2 of package."*", serialised in front of every PhotoCraft crate that uses craft. Build them at 0 (1 for the crates with per-frame or per-pixel code), as craft-libs does. Test-profile build on 8 cores: 34m53s -> 21m32s. * Build the framework at opt-level 1, not 0, in test builds At opt-level 0 the framework's stack frames overflowed the 2 MiB test-thread stack in ten more photocraft-ui-egui tests on the Windows runner (0xc00000fd). Level 1 still shares generic instantiations across crates. * Build the framework's panels, tools and services at opt-level 0 in test builds At opt-level 1 throughout, the Windows unit leg still built for 67 minutes. The runtime every frame passes through keeps level 1, so its stack frames stay small; the panels, tools and services around it, most of the framework's compile time, build at 0. * Wrap the test-profile comment --- Cargo.toml | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index b2ddec2a66..c64279b181 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -168,6 +168,75 @@ debug = "line-tables-only" [profile.test.package.photocraft-ui-egui] opt-level = 0 +# Test builds compile the craft UI framework (the `craft` facade and the craft-libs crates behind +# it) below the opt-level 2 of `package."*"` above. The workspace unifies the facade's features, so +# every crate that uses `craft`, photocraft-text included, waits for the whole framework. At 2 the +# chain from craft-host to the facade took 38 of the 77 build minutes of the Windows unit leg, and +# rustc shares no generic instantiations across crates at 2 (it does at 0 and 1). +# With the whole framework at 0, ten more photocraft-ui-egui tests overflowed their 2 MiB stack on +# Windows, so the runtime every frame passes through (contract, shell, canvas, panels, widgets, +# host) builds at 1, as do the crates with per-frame or per-pixel code (theme, behavior, imaging, +# text, font loading). The panels, tools and services around them build at 0, as in craft-libs. +# `cargo run` and `cargo build` use the dev profile and are unaffected. +[profile.test.package.craft] +opt-level = 1 +[profile.test.package.craft-ui] +opt-level = 1 +[profile.test.package.craft-ui-contract] +opt-level = 1 +[profile.test.package.craft-ui-shell] +opt-level = 1 +[profile.test.package.craft-ui-canvas] +opt-level = 1 +[profile.test.package.craft-ui-panels] +opt-level = 1 +[profile.test.package.craft-ui-widgets] +opt-level = 1 +[profile.test.package.craft-host] +opt-level = 1 +[profile.test.package.craft-theme] +opt-level = 1 +[profile.test.package.craft-behavior] +opt-level = 1 +[profile.test.package.craft-imaging] +opt-level = 1 +[profile.test.package.craft-text] +opt-level = 1 +[profile.test.package.craft-font-catalog] +opt-level = 1 +[profile.test.package.craft-ui-patterns] +opt-level = 0 +[profile.test.package.craft-draw] +opt-level = 0 +[profile.test.package.craft-color-ui] +opt-level = 0 +[profile.test.package.craft-font-manager] +opt-level = 0 +[profile.test.package.craft-font-store] +opt-level = 0 +[profile.test.package.craft-menu] +opt-level = 0 +[profile.test.package.craft-timeline] +opt-level = 0 +[profile.test.package.craft-layers] +opt-level = 0 +[profile.test.package.craft-automation] +opt-level = 0 +[profile.test.package.craft-theme-store] +opt-level = 0 +[profile.test.package.craft-update] +opt-level = 0 +[profile.test.package.craft-keymap] +opt-level = 0 +[profile.test.package.craft-dialogs] +opt-level = 0 +[profile.test.package.craft-settings] +opt-level = 0 +[profile.test.package.craft-platform] +opt-level = 0 +[profile.test.package.craft-window] +opt-level = 0 + [profile.release] lto = "thin" codegen-units = 1