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

[wip] optimize for eventual library size #1087

Closed
wants to merge 7 commits into from
Closed

[wip] optimize for eventual library size #1087

wants to merge 7 commits into from

Conversation

hpk42
Copy link
Contributor

@hpk42 hpk42 commented Dec 20, 2019

Right now, our release mode optimizes for speed.

As per https://github.com/johnthagen/min-sized-rust this PR tries three-settings to build a size-optimized release. Idea is to check what is the influence on the resulting apk and other artifacts.

@dignifiedquire
Copy link
Member

looks like this actually breaks windows builds

@hpk42 hpk42 changed the title optimize for eventual library size [wip] optimize for eventual library size Dec 20, 2019
@hpk42
Copy link
Contributor Author

hpk42 commented Dec 20, 2019

now the PR is just adding link-time-optimizations which, if i see it correctly, provide a significant reduction of compile time size. and this seems to work for windows as well. @r10s would be good to know if the new commit on this branch here still leads to a significant reduction of the apk. maybe you can trigger it again sometime ;) This does reduce the information (i guess) that you get with traces/crashes but maybe it's good to offer a full-debug build on get-dc and a size-optimized apk for gplay / get.delta.chat. If we automate apk-building this could all happen automatically ;)

@@ -10,6 +10,11 @@ license = "MIT OR Apache-2.0"
keywords = ["deltachat", "chat", "openpgp", "email", "encryption"]
categories = ["cryptography", "std", "email"]

#[profile.release]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove these commented out sections.

@link2xt
Copy link
Collaborator

link2xt commented Dec 21, 2019

Maybe some link time optimizations during JNI/Python bindings building also can be used, since only at this point the compiler knows which functions are actually used.

@r10s
Copy link
Member

r10s commented Dec 21, 2019

seems a if with only link-time-optimizations only half of the size-saving is possible:

-rw-r--r-- 64401673 Dec 20 17:15 deltachat-gplay-release-1.0.2.apk
-rw-r--r-- 46354476 Dec 20 18:12 deltachat-gplay-release-1.0.2-opt-size.apk
-rw-r--r-- 53425757 Dec 21 02:01 deltachat-gplay-release-1.0.2-lto-only.apk

so, instead of 18mb only 11mb are saved. still not bad, though.

@r10s
Copy link
Member

r10s commented Dec 21, 2019

new stats:

-rw-r--r--  64401673 Dec 20 17:15 deltachat-gplay-release-1.0.2.apk
-rw-r--r--  46354476 Dec 20 18:12 deltachat-gplay-release-1.0.2-opt-size.apk
-rw-r--r--  53425757 Dec 21 02:01 deltachat-gplay-release-1.0.2-lto-only.apk
-rw-r--r--  47303123 Dec 21 12:59 deltachat-gplay-release-1.0.2-lto-opt2.apk

@hpk42
Copy link
Contributor Author

hpk42 commented Dec 21, 2019 via email

@link2xt
Copy link
Collaborator

link2xt commented Dec 21, 2019

Our Windows builds are for i686 architecture, so it is likely that opt-level="z" exposes some memory corruption issue that we don't have on 3264-bit architectures. We can try adding i686 builds for Linux to CI and see if they break as well.

@dignifiedquire
Copy link
Member

dignifiedquire commented Dec 21, 2019 via email

@link2xt
Copy link
Collaborator

link2xt commented Dec 21, 2019

@dignifiedquire Sorry, I mean 64-bit architectures, corrected it now. These optimizations are done by LLVM and I expect it to be pretty stable.

@hpk42
Copy link
Contributor Author

hpk42 commented Jan 20, 2020

we have lto=true already in, moving to resurrection.

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.

4 participants