Skip to content

ci(web): build the web app with thin LTO, as native releases are built - #3590

Merged
Mavrick-F merged 1 commit into
opengeos:mainfrom
Mavrick-F:ci/web-thin-lto
Dec 2, 2026
Merged

Mavrick-F merged 1 commit into
opengeos:mainfrom
Mavrick-F:ci/web-thin-lto

Conversation

@Mavrick-F

@Mavrick-F Mavrick-F commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Summary

The web app's web profile used whole-program LTO in one codegen unit (#133). That build peaks at about 15.5 GB, against the 16 GB of a standard GitHub runner, and the docs preview's build lost its runner partway on several pull requests ("The hosted runner lost communication with the server", about 57 minutes in). Production deploys use the same build on the same runners, so they would start failing as the code grows. The profile now builds as native releases do, with thin LTO and 16 codegen units.

Measured on this box at 5fe168d, the same build Trunk runs (cargo build --locked --profile web --target wasm32-unknown-unknown -p rustgis-web), before Trunk's wasm-opt:

Setting Peak memory Build time gzip -9 zstd -19 Uncompressed
fat LTO, 1 codegen unit (before) 15.5 GB 19.5 min 26.4 MB 18.2 MB 87.1 MB
fat LTO, 16 codegen units 17.5 GB 17.8 min 27.4 MB 18.8 MB 92.3 MB
thin LTO, 16 codegen units (this PR) 2.7 GB 11.0 min 28.4 MB (+7.5%) 19.1 MB (+4.9%) 104.6 MB (+20%)

Fat LTO in more codegen units takes more memory, not less, so it isn't an alternative. Under fat LTO, two branches that touch the readers (#3547, #3558) peaked within 0.1 GB of their bases, so the code didn't push it there; the build was at the edge already. Those sizes are before wasm-opt. After it, as CI builds the app (this PR's docs preview against another's of the same hour, run 46811794643):

Setting Uncompressed gzip -9 zstd -19
fat LTO, 1 codegen unit (before) 71.2 MB 25.5 MB 17.5 MB
thin LTO, 16 codegen units (this PR) 75.7 MB (+6.4%) 27.5 MB (+8.0%) 18.4 MB (+5.0%)

On CI, the web app's build step took 16 min here, against 12–17 min for recent fat LTO builds; those reused a warm cache, which this profile change doesn't have yet, so the time saved on CI isn't shown here.

Surfaces: the web app's build only (Trunk, the docs preview, web deploys and releases). The desktop, command line, Python and phone builds are unchanged. No code changes.

Testing

  • The three builds above, one after another on one machine.
  • Full CI passed on this commit in the fork.

UI evidence

No visible UI change.

Related issue

None. Found while gating #3547 and #3558 for #2761.

Summary by CodeRabbit

  • Chores
    • Updated the web build profile to inherit optimization settings from the release profile.
    • Revised the estimated web build time to about ten minutes.

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.
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The web release profile no longer sets fat LTO or one codegen unit. Its comments describe thin LTO and report size and memory measurements. The CI comment changes the estimated build time from about fifteen minutes to about ten minutes.

Changes: Web release profile

Layer / File(s) Summary
Web profile settings and estimate
Cargo.toml, .github/workflows/ci.yml
The web profile inherits its LTO and codegen-unit settings from release. Comments describe thin LTO and report size and memory measurements. The CI comment changes the estimated build time to about ten minutes.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Suggested reviewers: giswqs, pick2510

Merge Risk: Minimal · up to 79043

This switches the web build to thin LTO to cut CI memory use and build time, at the cost of a somewhat larger download. No functional behavior changes, and no merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the web app build moves to thin LTO, matching native releases. The title is specific, but it does not give the reason (memory and runner limits). It also omits the 16 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is thorough and covers the template's required content. The Summary explains the problem (the web profile peaks near the 16 GB runner limit, and docs-preview builds lost their runners)…
Full details: Title check

Explanation

The title names the main change: the web app build moves to thin LTO, matching native releases. The title is specific, but it does not give the reason (memory and runner limits). It also omits the 16 codegen units change. The title matches the changeset.

Full details: Description check

Explanation

The description is thorough and covers the template's required content. The Summary explains the problem (the web profile peaks near the 16 GB runner limit, and docs-preview builds lost their runners), the change (thin LTO with 16 codegen units), and the measured trade-offs. The Testing section lists the three sequential builds and the passing CI run. The UI evidence section states 'No visible UI change.', which the template allows when no visible UI changes. The Related issue section says 'None' and gives context about #2761. The description is mostly complete, so the check passes. Minor gap: the Summary says the change is for web builds only, but it does not list the template's optional tag placeholders, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the build settings with care
Thin LTO leaves its mark in the file
The web profile inherits the release
Ten minutes now appears in the note
The rabbit hops off, content with the change

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 5202253c-0a49-4cfb-98eb-1ea097ff2f8d
Commits

Reviewing files that changed from the base of the PR and between 6d60849 and 790433b.

Files selected for processing: 2

  • .github/workflows/ci.yml
  • Cargo.toml

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment thread Cargo.toml
# 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%

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (not a defect): this comment hard-codes measurements (5–8%, 15.5 GB, 2.7 GB) taken on one machine, and they will go stale on the next dependency or code change. The trade-off itself is accurate per the PR table (gzip 26.4 → 28.4 MB, zstd 18.2 → 19.1 MB; uncompressed 87.1 → 104.6 MB), but the uncompressed size grows about 20%, and the comment only mentions the compressed download. Consider stating the reason and the trade-off once, without the figures, and pointing to the PR for numbers.

Category: quality

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the figures will age; the PR keeps them. Left for the release quality pass.

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, security issues or AGENTS.md violations in this PR. It changes build configuration only: [profile.web] now inherits thin LTO and 16 codegen units from release instead of fat LTO and one codegen unit, and a comment in .github/workflows/ci.yml is reworded to match.

Bugs: none found. Nothing else in the repo depends on the web profile's fat LTO. I searched for other LTO or codegen-unit settings, wasm size budgets and profile references in docs/, CI and the web app, and found none that the change breaks.

Security: none.

Performance: the trade-off is disclosed in the PR body, not a regression. The web bundle gets larger: compressed download +5–8% (gzip 26.4 → 28.4 MB, zstd 18.2 → 19.1 MB), uncompressed +20% (87.1 → 104.6 MB). The PR's "about 5–8%" wording in the Cargo.toml comment only covers the compressed size. The build peak drops from 15.5 GB to 2.7 GB, which is the reason for the change. Confidence: high that the numbers are as reported; the post-wasm-opt size is not measured in the PR.

Quality:

  • Nit, inline on Cargo.toml:192: the comment hard-codes single-machine measurements that will go stale, and mentions only the compressed download. Posted as a buffered inline comment.
  • Nit, .github/workflows/ci.yml:103: the new comment says "about ten minutes", but the PR's own measurement is 11.0 min on a local box, not on CI runners. Wording only.

AGENTS.md: no violations. Checked against "Reach every surface": the change affects only the web build, which the PR body states. "Size for real data" does not apply because no layer data is stored or copied. The ci: label rules do not apply because nothing platform-specific changed.

Unverified: the PR says full CI passed in the fork. I could not check that, and I did not rebuild the wasm target or re-run the timing measurements.

Earlier concerns: prior-reviews.json has no threads, so I did not skip any concern as already raised.

Change size

Compared: the whole PR against main (merge base 5da4e06 to PR head 790433b).

Measure Value
Files changed 2 (0 added, 2 modified, 0 removed, 0 renamed)
Size before 37.6 KB
Size after 37.6 KB
Total size change -10 B
Path Before After Change
.github/workflows/ci.yml 28.8 KB 28.8 KB -12 B
Cargo.toml 8.8 KB 8.8 KB +2 B

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3590/
Web app https://preview.rustgis.app/pr-3590/app/
Commit 790433b

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@Mavrick-F
Mavrick-F added this pull request to the merge queue Dec 2, 2026
Merged via the queue into opengeos:main with commit fead4fe Dec 2, 2026
32 checks passed
@Mavrick-F
Mavrick-F deleted the ci/web-thin-lto branch December 2, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant