Skip to content

build(native): configure Cargo profiles - #313

Merged
chenjiahan merged 1 commit into
mainfrom
chenjiahan/build-cargo-profiles
Aug 11, 2026
Merged

build(native): configure Cargo profiles#313
chenjiahan merged 1 commit into
mainfrom
chenjiahan/build-cargo-profiles

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Summary

This PR adds explicit Cargo profiles for local development, CI, and published native bindings. CI uses an optimized profile without release-only fat LTO, while release builds use one codegen unit, fat LTO, abort-on-panic, and symbol stripping.

Binary size

Measured with clean NAPI-RS release builds from identical sources and toolchains on aarch64-apple-darwin.

Metric Before After Change
Raw .node 1,281,936 B 1,066,560 B -215,376 B (-16.80%)
gzip -9 588,693 B 510,889 B -77,804 B (-13.22%)

The exception and unwind sections decreased by 132,616 B, accounting for most of the reduction.

Validated with Cargo formatting, clippy, CI-profile tests, CI and release NAPI builds, package builds and checks, and 223 Rstest cases against both native profiles.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying rstack-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3703457
Status: ✅  Deploy successful!
Preview URL: https://2d949b40.rstack-cli.pages.dev
Branch Preview URL: https://chenjiahan-build-cargo-profi.rstack-cli.pages.dev

View logs

@chenjiahan
chenjiahan marked this pull request as ready for review August 11, 2026 07:29
@chenjiahan
chenjiahan merged commit 86418a5 into main Aug 11, 2026
5 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/build-cargo-profiles branch August 11, 2026 07:43
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