Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: decrease .whl filesize #603

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

IdoKendo
Copy link
Contributor

Description

This PR reduces the .whl file size to 2.2MB on release mode. This is about 30% smaller than current build size which is 3.4MB - I have not seen any performance degradation or issues arise from these changes so it's a net gain by tweaking these values.

@netlify
Copy link

netlify bot commented Sep 12, 2023

👷 Deploy request for robyn pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit b94e79a

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 12, 2023

CodSpeed Performance Report

Merging #603 will not alter performance

Comparing IdoKendo:chore/decrease-whl-file-size (b94e79a) with main (256a0c4)

Summary

✅ 106 untouched benchmarks

Comment on lines +42 to +44
codegen-units = 1
lto = true
panic = "abort"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @IdoKendo 👋

Thank you for the great work 😄 Can you please share some documentation of these three flags? Or explain what is the purpose of these three flags?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IdoKendo , what are the other two here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. By default, Cargo instructs compilation units to be compiled and optimized in isolation. LTO instructs the linker to optimize at the link stage. This can, for example, remove dead code and often times reduces binary size.
  2. By default, when Rust code encounters a situation when it must call panic!(), it unwinds the stack and produces a helpful backtrace. The unwinding code, however, does require extra binary size. rustc can be instructed to abort immediately rather than unwind, which removes the need for this extra unwinding code.
    ref: https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LTO -> Link Time Optimization

Copy link
Member

@sansyrox sansyrox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing. Great work @IdoKendo 🔥

@sansyrox sansyrox merged commit de33ea8 into sparckles:main Sep 18, 2023
47 checks passed
@IdoKendo IdoKendo deleted the chore/decrease-whl-file-size branch October 2, 2023 11:18
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