-
Notifications
You must be signed in to change notification settings - Fork 258
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
Enable LTO for Android #165
Conversation
if (is_win) { | ||
# Favor size over speed, /O1 must be before the common flags. The GYP | ||
# build also specifies /Os and /GF but these are implied by /O1. | ||
cflags = [ "/O1" ] + common_optimize_on_cflags + [ "/Oi" ] | ||
} else if (is_android || is_ios) { | ||
} else if (is_ios) { | ||
cflags = [ "-Os" ] + common_optimize_on_cflags # Favor size over speed. |
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.
Using -Oz
on iOS builds actually increases size, even though clang doc says:
-Oz Like -Os (and thus -O2), but reduces code size further.
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.
Interesting - @petrhosek might have more info.
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.
This is not entirely surprising. LTO usually leads to size increase due to inlining and it currently doesn't currently take -Oz
into account. We had some discussions about this in the past, but the conclusion is that it's not quite clear what LTO with -Oz
should do since those are to some extent conflicting options.
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.
Thanks for the explanation!
Please keep an eye on the benchmarks after this rolls into the framework. |
Will do! |
Size reductions of libflutter.so:
Fixes flutter/flutter#16538.