[swift-users] Swift Binary Size vs. Obj-C

Seth Friedman sethfri at gmail.com
Wed Jun 15 17:43:34 CDT 2016


Hi all,

I've seen a ton of blog posts written about all of the cool and exciting
things about Swift, but I haven't see anything really about the downsides
(besides the occasional post about pain points with interoperability).
What's of biggest concern to me when considering migrating my company's app
from Objective-C to Swift is binary size. Swift binary size seems to be
several times larger than Objective-C, and I'm curious what data there is
in the community to support this suspicion.

For some quick data points, I created a single view controller project in
Obj-C and one in Swift, turned off bitcode to get a better idea of what the
binary size on device would be, and archived them. I did this in Xcode 8
Beta 1 using Swift 3 so that I'd make sure to get any binary size
improvements in Swift 3.

The Obj-C IPA file was 639 KB. The Swift IPA file was *23.6 MB*. I know
that the Swift runtime libs are about 4.5 MB, but subtracting that, the
Swift IPA file is still *30x bigger than the Obj-C equivalent*. Next, I
tried adding a simple table view controller, a Person model with a first
and last name, and a data source that puts the first and last names in the
table view in an attempt to make a functioning app. However, the binary
sizes were about the same (the Obj-C one actually decreased to 635 KB).

When we're talking about binary sizes this small, it's not a big deal, but
my company's app is currently 81 MB, about 35 MB of which is code, and the
rest is assets. If the code part of the binary size increases by orders of
magnitude like this, we'll go way over the 100 MB cellular limit that Apple
has set. This is also a really bad experience for customers in emerging
markets like China and India that have poor connections.

Can anyone confirm or deny that Swift binary size is orders of magnitude
larger than Objective-C? I'm looking for the specific increase we'll see to
take to my management in order to make a justification for whether it's
worth it for our customers.

Thanks!

Seth Friedman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160615/c1d149f3/attachment.html>


More information about the swift-users mailing list