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

Turn off exceptions to reduce binary size (-600KB for arm64) #1033

Merged
merged 2 commits into from
Jul 16, 2018

Conversation

Adlai-Holler
Copy link
Member

@Adlai-Holler Adlai-Holler commented Jul 16, 2018

We don't currently use exceptions so we don't need the extra binary to support them.

-fno-exceptions removes unwind tables and makes C++ STL put "abort" wherever there would be an exception.
-fno-objc-arc-exceptions removes code that ARC adds to prevent leaks in the case of exceptions https://clang.llvm.org/docs/AutomaticReferenceCounting.html#exceptions

How big is the win?

  • In terms of total o-file size, the framework goes from 33.3MB to 31.5MB for ARM64 release builds.
  • In terms of executable size, the CatDealsCollectionView ARM64 release binary goes from 12.3MB to 11.7MB.

So modulo any Apple fiddling with your binary, the 64-bit one should shrink by about 600KB.

@ghost
Copy link

ghost commented Jul 16, 2018

🚫 CI failed with log

@Adlai-Holler
Copy link
Member Author

The CI is just plain broken =/

@@ -30,7 +30,7 @@
#define ASSetDebugName(node, format, ...) node.debugName = [NSString stringWithFormat:format, __VA_ARGS__]
#define ASSetDebugNames(...) _ASSetDebugNames(self.class, @"" # __VA_ARGS__, __VA_ARGS__, nil)
#else
#define ASSetDebugName(node, name)
#define ASSetDebugName(node, format, ...)
Copy link
Member Author

Choose a reason for hiding this comment

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

This was breaking release builds. I guess nobody uses this macro!!

Copy link
Member

@appleguy appleguy left a comment

Choose a reason for hiding this comment

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

Strong win!

@appleguy appleguy changed the title Turn off exceptions to reduce binary size Turn off exceptions to reduce binary size (-600KB for arm64) Jul 16, 2018
Copy link
Member

@nguyenhuy nguyenhuy left a comment

Choose a reason for hiding this comment

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

Nice!

@Adlai-Holler Adlai-Holler merged commit 6ed5ba2 into master Jul 16, 2018
@Adlai-Holler Adlai-Holler deleted the AHNoExceptions branch July 16, 2018 16:38
mikezucc pushed a commit to mikezucc/Texture that referenced this pull request Oct 2, 2018
…Group#1033)

* Turn off exceptions to reduce binary size

* Changelog
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