From 790433bdd133cf1590a7011d2ae189d434bd5fc8 Mon Sep 17 00:00:00 2001 From: mavrick Date: Tue, 1 Dec 2026 22:10:06 -0600 Subject: [PATCH] ci(web): build the web app with thin LTO, as native releases are built Whole-program LTO in one codegen unit took 15.5 GB at its peak, against the 16 GB of CI's runners, which lost the docs preview's build partway several times. Thin LTO takes 2.7 GB and about half the time; the download is about 5-8% larger. --- .github/workflows/ci.yml | 2 +- Cargo.toml | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67ce77d6a1..a86f63869f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,7 @@ jobs: curl -sSfL --retry 5 --retry-all-errors -o "$RUNNER_TEMP/trunk.tar.gz" https://github.com/trunk-rs/trunk/releases/download/v0.21.14/trunk-x86_64-unknown-linux-gnu.tar.gz echo "f2b4680cd239693a646a2795e4633c625328d7b2a044fbe749fa3a2fe9e7036b $RUNNER_TEMP/trunk.tar.gz" | sha256sum -c - mkdir -p "$RUNNER_TEMP/bin" && tar xzf "$RUNNER_TEMP/trunk.tar.gz" -C "$RUNNER_TEMP/bin" trunk - # The page names the release profile (`web`, fat LTO: a quarter of an hour), which would + # The page names the release profile (`web`, about ten minutes), which would # outrank --cargo-profile; this throwaway checkout drops it to package the dev build. sed -i 's/ data-cargo-profile="web"//' apps/rustgis-web/index.html if grep -q 'data-cargo-profile=' apps/rustgis-web/index.html; then echo "::error::apps/rustgis-web/index.html still names a Cargo profile" >&2; exit 1; fi diff --git a/Cargo.toml b/Cargo.toml index 6c967740cf..d607130553 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -188,10 +188,8 @@ opt-level = 3 lto = "thin" codegen-units = 16 -# The web app's build (Trunk, `data-cargo-profile` in apps/rustgis-web/index.html): whole-program -# LTO in one codegen unit makes the WebAssembly about a sixth smaller, a quicker download for -# the web app. Slower to build, so native releases keep thin LTO. +# The web app's build (Trunk, `data-cargo-profile` in apps/rustgis-web/index.html), as native +# releases are built: thin LTO. Whole-program LTO in one codegen unit made the download about 5–8% +# smaller, but took 15.5 GB at its peak (2.7 GB this way) and lost CI's 16 GB runners partway. [profile.web] inherits = "release" -lto = "fat" -codegen-units = 1