Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Update build configurations and reduce binary size #134

Open
julianrex opened this issue Jan 6, 2020 · 5 comments
Open

Update build configurations and reduce binary size #134

julianrex opened this issue Jan 6, 2020 · 5 comments

Comments

@julianrex
Copy link
Contributor

mapbox-gl-native is simplifying the build configurations, to just Debug and Release (see mapbox/mapbox-gl-native#16083).

We need to do the same.

We can handle a "stripped" build (i.e. what is currently Release) as a packaging step, i.e. by default the new Release configuration will contain debug symbols.

At the same time we should consider #22

@julianrex
Copy link
Contributor Author

Following on from #63:

Currently the release frameworks are NOT building with -flto or -Os, which has resulted in an increase in binary size. Here are some stats when building with various optimizations.

Build settings framework size 1 dSYM size 2 arm64 slice size 3 arm64 no bitcode 4 arm64 stripped 5 __TEXT 6 __DATA __OBJC others
5.8.0 148065160 639619389 62868360 10439560 5162968 4800512 245760 0 116696
-Os -flto 85817300 344712182 38254548 4241364 4241364 3883008 245760 0 112596
-Oz -flto 72817804 325747720 31759500 3579020 3579020 3211264 245760 0 121996

Looking at compiling with -Os -flto, the framework size is brought back to original levels - though when compiling with -Oz the result is even more dramatic (~30% size reduction).

I would suggest that we update with -Os, then compare performance when compiling with -Oz ("outlining").

Symbols should be included the dSYM; though the size is much smaller compared with 5.8.0 so I suspect I made an error with the symbol handling. Need to check debugging, and call stacks on crashes.

These stats were built from the jrex/build-tests branch building with make iframework BUILDTYPE=Release BUILD_DOCS=false


Notes:

  1. Size of the Mapbox binary in the framework directory
  2. Size of the binary in the Mapbo.framework.dSYM/Contents/Resources/DWARF/ directory
  3. Size of the arm64 slice, extracted by: lipo Mapbox.framework/Mapbox -thin arm64 -output Mapbox-arm64
  4. Size of binary generated by 3, with bitcode removed: xcrun bitcode_strip Mapbox-arm64 -r -o Mapbox-arm64-no-bitcode
  5. Size of binary generated by 4, with symbols stripped: strip -Sx Mapbox-arm64-no-bitcode -o Mapbox-arm64-no-bitcode-stripped
  6. Remaining columns are from running size on the above binary.

@julianrex julianrex assigned fabian-guerra and unassigned julianrex Apr 27, 2020
@julianrex
Copy link
Contributor Author

Noting that we should consider a separate Github release artifact for the dSYM and bcsymbolmap files (see also mapbox/mapbox-gl-native-android#134).

@1ec5
Copy link
Contributor

1ec5 commented Apr 28, 2020

Noting that we should consider a separate Github release artifact for the dSYM and bcsymbolmap files (see also mapbox/mapbox-gl-native-android#134).

Note that Carthage (#143) expects the .dSYM to appear in the same .framework.zip archive as the executable.

@julianrex
Copy link
Contributor Author

Note that Carthage (#143) expects the .dSYM to appear in the same .framework.zip archive as the executable.

Ok, so multiple packages 😭

@julianrex julianrex changed the title Update build configurations Update build configurations and reduce binary size May 4, 2020
@julianrex
Copy link
Contributor Author

Have split out the update of Release and RelWithDebInfo configuration into a separate PR: mapbox/mapbox-gl-native#16460, so that existing build scripts/packaging is not changed.

I think it's still valid to consolidate configurations to just Release & Debug, so this ticket can be kept open for the time-being.

@knov knov modified the milestones: release-water, release-xiao May 18, 2020
@knov knov removed this from the release-xoài milestone Jul 29, 2020
@stale stale bot added the archived label Mar 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants