Skip to content

perf: build the native library with Typst's release profile - #57

Merged
evolvedlight merged 1 commit into
evolvedlight:developfrom
swisspost:perf/release-profile
Oct 17, 2026
Merged

evolvedlight merged 1 commit into
evolvedlight:developfrom
swisspost:perf/release-profile

Conversation

@msallin

@msallin msallin commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

This adds a [profile.release] to typst_core with lto = "thin" and codegen-units = 1, the settings Typst's own workspace is released with. panic stays at unwind, because compile relies on catch_unwind.

The point is a smaller library:

Windows x64 typst_core.dll Size
before 51.6 MB
after 48.3 MB

Speed: no measurable change. I ran each build six times, alternating between them, on a 30-page document. Median results for cold and warm PDF, PNG and SVG were within -8% to +4% of each other, which is inside the run-to-run noise on this machine.

Cost: a full release build took about 5 minutes locally, so CI pack builds get slower.

cargo test --release passes, and so do all 80 .NET tests against the library built with the new profile.

Thin LTO and a single codegen unit, the settings Typst itself is released
with. The Windows x64 typst_core.dll goes from 51.6 MB to 48.3 MB. Compile
speed is unchanged within measurement noise; a full release build takes
longer.
@evolvedlight
evolvedlight merged commit af08cd9 into evolvedlight:develop Oct 17, 2026
5 checks passed
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.

2 participants