Skip to content

build: optimize release binaries and report packaged size - #545

Open
QuadnucYard wants to merge 1 commit into
typstyle-rs:masterfrom
QuadnucYard:build/optimize-size
Open

QuadnucYard wants to merge 1 commit into
typstyle-rs:masterfrom
QuadnucYard:build/optimize-size

Conversation

@QuadnucYard

Copy link
Copy Markdown
Collaborator

Use one codegen unit in the native ci profile to reduce duplicate monomorphizations and give LLVM more scope to optimize. On Windows x64, this reduced typstyle.exe from 2,161,664 to 1,800,704 bytes (16.7%).

Use cargo bloat to build the Linux x64 executable in regular CI and retain its per-crate code sizes. Record the exact file size after splitting debug symbols, when the executable is ready to upload.

Compare the base and proposed merge in the PR report. Fetch their size reports from CI so Criterion can run without rebuilding the CLI.

Use one codegen unit in the native `ci` profile to reduce duplicate
monomorphizations and give LLVM more scope to optimize. On Windows x64,
this reduced `typstyle.exe` from 2,161,664 to 1,800,704 bytes (16.7%).

Use `cargo bloat` to build the Linux x64 executable in regular CI and
retain its per-crate code sizes. Record the exact file size after
splitting debug symbols, when the executable is ready to upload.

Compare the base and proposed merge in the PR report. Fetch their size
reports from CI so Criterion can run without rebuilding the CLI.
@github-actions

Copy link
Copy Markdown

📊 Benchmark Performance Report

group                               base                                   pr
-----                               ----                                   --
pretty-ai-comprehensive-showcase    1.00    861.5±5.27µs        ? ?/sec    1.00    858.8±7.25µs        ? ?/sec
pretty-cetz-manual                  1.01   698.2±13.26µs        ? ?/sec    1.00    690.3±7.38µs        ? ?/sec
pretty-codly                        1.00  1688.6±15.84µs        ? ?/sec    1.00  1689.3±11.49µs        ? ?/sec
pretty-cpe                          1.00     11.6±0.44ms        ? ?/sec    1.72     20.0±2.20ms        ? ?/sec
pretty-deep-nested-args             1.00     15.0±0.15µs        ? ?/sec    1.00     15.0±0.15µs        ? ?/sec
pretty-fletcher-diagram             1.00   483.6±19.30µs        ? ?/sec    1.00    485.4±5.17µs        ? ?/sec
pretty-fletcher-draw                1.00  1185.2±15.95µs        ? ?/sec    1.00  1181.5±10.01µs        ? ?/sec
pretty-tablex                       1.00      3.2±0.02ms        ? ?/sec    1.01      3.2±0.12ms        ? ?/sec
pretty-touying-core                 1.00      2.0±0.03ms        ? ?/sec    1.00      2.0±0.01ms        ? ?/sec
pretty-touying-utils                1.00  1147.1±11.34µs        ? ?/sec    1.01  1160.1±31.10µs        ? ?/sec
pretty-undergraduate-math           1.02   870.3±15.40µs        ? ?/sec    1.00   851.4±14.70µs        ? ?/sec
typst-docs/all                      1.00     10.5±0.40ms    53.0 MB/sec    1.05     11.1±0.73ms    50.5 MB/sec
typst-docs/wrap/fill                1.00     17.4±0.41ms    32.2 MB/sec    1.00     17.4±0.28ms    32.0 MB/sec
typst-docs/wrap/fill-sentence       1.01     22.0±0.73ms    25.4 MB/sec    1.00     21.7±0.38ms    25.7 MB/sec
typst-docs/wrap/sentence            1.00     15.5±0.08ms    36.1 MB/sec    1.00     15.5±0.25ms    36.0 MB/sec

📏 Binary Size Comparison (x86_64-unknown-linux-gnu)

Metric Base PR Change
Release executable unavailable 2226576 B
Text section unavailable 1309139 B
📦 Crate Sizes (cargo-bloat)

Per-crate code sizes are estimates.

std                       396.2 kB
clap_builder              256.7 kB
typstyle_core             142.8 kB
typst_syntax              103.9 kB
typstyle                  92.8 kB
similar                   90.9 kB
clap_complete             80.9 kB
prettyless                25.9 kB
walkdir                   12.4 kB
anyhow                    8.4 kB
colored                   8.2 kB
hashbrown                 6.7 kB
darling_core              6.3 kB
unicode_segmentation      6.2 kB
vergen_gitcl              5.0 kB
heck                      4.8 kB
ecow                      4.7 kB
synstructure              4.2 kB
proc_macro2               3.9 kB
anstream                  3.5 kB

Generated by GitHub Actions on 2026-11-28 13:57:31 UTC
Compiler: rustc 1.100.1 (20ddd0171 2026-11-25)
CPU: AMD EPYC 7763 64-Core Processor (x86_64)

This branch has not been deployed

No deployments
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