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

Increase compiler optimization when using target=release on iOS/Android #60358

Merged

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Apr 18, 2022

This improves performance on projects exported in release mode on iOS and Android, at the cost of slightly increased binary sizes.

Note that this may not be safe to cherry-pick to 3.x on iOS (assuming the bug mentioned in godotengine/godot-proposals#1987 was fixed in the GDScript rewrite in master).

Copy link
Contributor

@m4gr3d m4gr3d left a comment

Choose a reason for hiding this comment

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

The Android section looks good!

@akien-mga
Copy link
Member

If it's the only change, it's keep the startswith and just do:

opt = "-O3" if env["target"] == "release" else "-O2"
env.Append(CCFLAGS=[opt, ...])
env.Append(LINKFLAGS=[opt])

BTW, it seems weird that -O3 gets passed as a link flag, that doesn't make much sense. It's probably ignored by Clang.

For size optimization, we could try -Oz on platforms that build with Clang.

All this will need thorough regression testing of course.

@Calinou
Copy link
Member Author

Calinou commented Apr 25, 2022

For size optimization, we could try -Oz on platforms that build with Clang.

I'd probably make that a separate option (such as optimize=size_extra), as -Oz is more aggressive and can lose quite a lot of speed compared to -Os.

@akien-mga
Copy link
Member

If it's the only change, it's keep the startswith and just do: [...]

WDYT about this change? Worth doing, or do you prefer to keep it as is?

@Calinou Calinou force-pushed the scons-android-ios-tweak-optimization branch from 302eba8 to 2a0496e Compare May 12, 2022 23:11
@Calinou
Copy link
Member Author

Calinou commented May 12, 2022

WDYT about this change? Worth doing, or do you prefer to keep it as is?

It looks more readable with your change, so I applied it 🙂

@Calinou Calinou force-pushed the scons-android-ios-tweak-optimization branch from 2a0496e to 78b4ec2 Compare May 12, 2022 23:12
@akien-mga akien-mga merged commit 6a9a76d into godotengine:master May 13, 2022
@akien-mga
Copy link
Member

Thanks!

@Calinou Calinou deleted the scons-android-ios-tweak-optimization branch May 13, 2022 16:47
@akien-mga
Copy link
Member

Cherry-picked for 3.5.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants