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

Add profile release #1346

Merged
merged 2 commits into from
Jul 14, 2022
Merged

Add profile release #1346

merged 2 commits into from
Jul 14, 2022

Conversation

Luni-4
Copy link
Contributor

@Luni-4 Luni-4 commented May 20, 2022

This PR adds a profile.release-opt to reduce binaries size, but at the same time enables some optimizations.
Using this profile, I was able to reduce the bezier_tool binary from 15.6 MB to 7.1MB, I haven't checked the other binaries though.

To use the profile:

cargo build --profile release-opt

I hope this is appreciated, thanks in advance for your review!

@Luni-4
Copy link
Contributor Author

Luni-4 commented Jul 1, 2022

@hecrj Is there any update on this one?

Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

I understand this improves the release profile for the examples at the cost of compilation time, but the default configuration is still valuable during development as we may want to build in release mode as well.

Instead, I believe we should mention these settings somewhere in our documentation or book.

@Luni-4
Copy link
Contributor Author

Luni-4 commented Jul 14, 2022

Yeah, I understand what you're saying, since release mode might be used in the development phase too, increasing the compilation time could not be an optimal solution.

Perhaps we can explore the new custom profiles feature in order to reduce binary sizes

We could have something like this:

cargo build --profile release-less-binary-size

In this way we don't affect the default release profile at all. What do you think of this solution @hecrj?

We can also add the release configurations of this PR and the new custom profiles in documentation or iced book.

@hecrj
Copy link
Member

hecrj commented Jul 14, 2022

In this way we don't affect the default release profile at all. What do you think of this solution @hecrj?

That sounds great. If we can just have these settings in a release-opt profile then that would be awesome:

[profile.release-opt]
inherits = "release"
codegen-units = 1
debug = false
lto = true
incremental = false
opt-level = 3
overflow-checks = false
strip = "debuginfo"

@hecrj hecrj added improvement An internal improvement developer experience labels Jul 14, 2022
@hecrj hecrj added this to the 0.5.0 milestone Jul 14, 2022
@Luni-4
Copy link
Contributor Author

Luni-4 commented Jul 14, 2022

That sounds great. If we can just have these settings in a release-opt profile then that would be awesome:

[profile.release-opt]
inherits = "release"
codegen-units = 1
debug = false
lto = true
incremental = false
opt-level = 3
overflow-checks = false
strip = "debuginfo"

That's great! Thank you!

Do you also want me to create a ci-profile to remove those lines https://github.com/iced-rs/iced/blob/master/.github/workflows/build.yml#L93-L96 ? I can do that in another PR if you prefer

@hecrj
Copy link
Member

hecrj commented Jul 14, 2022

Do you also want me to create a ci-profile to remove those lines https://github.com/iced-rs/iced/blob/master/.github/workflows/build.yml#L93-L96 ?

Actually, we can just use the new custom profile! I just did that in 7022090.

Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

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

Looks great now! Thank you! 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants