Skip to content

Optimize Rust release binary size#40

Merged
Gabriel Dufresne (GabrielDuf) merged 1 commit into
masterfrom
mamoreau-devolutions-optimize-rust-binary-size
Jun 19, 2026
Merged

Optimize Rust release binary size#40
Gabriel Dufresne (GabrielDuf) merged 1 commit into
masterfrom
mamoreau-devolutions-optimize-rust-binary-size

Conversation

@mamoreau-devolutions

@mamoreau-devolutions Marc-André Moreau (mamoreau-devolutions) commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add size-focused release profile settings for the Rust workspace: symbol stripping, LTO, single codegen unit, opt-level = "z", and aborting panics
  • Disable jsonschema's unused HTTP resolver and remove the unused CLI reqwest dependency
  • Remove reqwest's JSON feature from pinget-core by using existing serde_json serialization/parsing in REST paths

Size impact

  • Baseline cargo build -q -p pinget-cli --manifest-path rust\Cargo.toml --release: 28,922,368 bytes (27.58 MiB)
  • Optimized release build: 11,576,320 bytes (11.04 MiB)
  • Reduction: 17,346,048 bytes (16.54 MiB), about 60% smaller

Validation

  • cargo +nightly fmt --manifest-path rust\Cargo.toml --all
  • cargo clippy -q --manifest-path rust\Cargo.toml --workspace --tests -- -D warnings
  • cargo test -p pinget-core --manifest-path rust\Cargo.toml
  • cargo test -p pinget-cli --manifest-path rust\Cargo.toml
  • cargo build -q -p pinget-cli --manifest-path rust\Cargo.toml --release

Enable size-focused release profile settings and trim unused reqwest/json and jsonschema HTTP resolver features while preserving local schema validation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@GabrielDuf Gabriel Dufresne (GabrielDuf) merged commit de036ab into master Jun 19, 2026
13 checks passed
@GabrielDuf Gabriel Dufresne (GabrielDuf) deleted the mamoreau-devolutions-optimize-rust-binary-size branch June 19, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants