Closed julianrex closed 4 years ago
As expected, this change has affected performance (both negative and positive), but the generated framework size is much smaller (149Mb -> 72Mb).
@alexshalamov what's your reading of the performance changes?
/cc @knov
thoughts here @alexshalamov @1ec5
/cc @chloekraw
@julianrex Have you tried running benchmarks and checking difference between -Os an -Oz? If not and it is not super-urgent to land this PR, I can try running benchmarks on device and see if there is a significant difference.
I haven't tried checking the performance for -Oz
, though the binary size improvement was significant.
Given the SDK was previously built with -Os
I didn't want to jump straight to -Oz
😁
An alternative to this PR might be to have cmake specify an xcconfig file that optionally includes a platform xcconfig file. This would allow the iOS SDKs to override any of the build settings. However, I'm a little uncomfortable with that.
I do think there is scope in gl-native to fine tune the optimizations on a per-file basis. It's a lot of effort, but could give us a good balance of size vs speed.
Remember to say something about this build configuration change in the changelog.
(Oh also, if you can make these same changes to macos.cmake, I’d be much obliged.)
@julianrex didn't see much difference in performance benchmarks between -Os and -Oz -Os https://circleci.com/gh/mapbox/mapbox-gl-native/436724#artifacts/containers/0 -Oz https://circleci.com/gh/mapbox/mapbox-gl-native/436745#artifacts/containers/0
~@alexshalamov Once I update macOS, how do I change the benchmark baselines so the benchmark runners don't fail?~
How did the iOS benchmark runner go green below??
@julianrex @knov -Os
regresses performance for iOS targets, for almost all tests. In some cases > 15% performance drop. results_comparison.txt
Maybe worth re-thinking some of the flags or making two builds? One optimized for performance while the other for binary size?
For context, we switched from -O3
to -Os
in #4641 on iOS and OS X and in #8253 for all platforms. At the time, that change nearly halved the size of the framework binary with no perceivable performance hit.
When we (inadvertently) switched back to -O3
, how much of a binary size regression did we see?
This pull request has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
See https://github.com/mapbox/mapbox-gl-native-ios/issues/134 for context.
This PR adds
-Os
and-flto
for theRelease
andRelWithDebInfo
configurations, both of which are currently used by the iOS Maps SDK release process. (This is a possible first step in transitioning iOS to just use Release & Debug configurations).It turned out it wasn't sufficient to set these optimization settings by "just" changing the gcc flags, instead it needed to be changed with:
There may be a better way (I'm definitely a cmake novice), so would appreciate any improvements.
cc @mapbox/maps-ios @1ec5