-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
chore: decrease .whl filesize #603
Conversation
👷 Deploy request for robyn pending review.Visit the deploys page to approve it
|
CodSpeed Performance ReportMerging #603 will not alter performanceComparing Summary
|
codegen-units = 1 | ||
lto = true | ||
panic = "abort" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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.
- 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LTO -> Link Time Optimization
There was a problem hiding this 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 🔥
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.