Skip to content

Conversation

@charlespierce
Copy link
Contributor

@charlespierce charlespierce commented Aug 15, 2024

Info

  • Despite putting a large focus on performance (and to some extent, binary size), we haven't taken advantage of Rust's ability to enable link-time optimizations (LTO).
  • These optimizations can improve performance and reduce binary size, at the cost of taking longer at compilation.

Changes

  • Updated Cargo.toml to enable fat LTO in release builds of Volta
  • Also added codegen-units = 1, which is another setting which increases final performance at the cost of compile time (see the Rust Performance Book for more details).

Tested

  • On Windows, this results in an ~10% reduction in binary size. I didn't see any significant performance difference.
  • On macOS (M2 Max), I see ~25% reduction in binary size (!) and ~5% faster performance for a simple test.
  • The CI builds take slightly longer, but not massively so to the point where running them with full optimizations would impact PRs.

@charlespierce charlespierce marked this pull request as ready for review August 16, 2024 18:42
@charlespierce charlespierce merged commit bd1b4ce into volta-cli:main Aug 16, 2024
@charlespierce charlespierce deleted the enable_fat_lto branch August 16, 2024 18: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