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

Seth Friedman sethfri at gmail.com
Wed Jun 15 19:16:12 CDT 2016


Thanks for the quick reply. You guys are right on part of it; the runtime
libraries are causing the majority of the increase. I thought the Swift
runtime libraries were supposed to only take up 4.5 MB though? Did they
increase with Swift 3? If I add up all of the libraries, they take up a
total of 22.88 MB in the binary. About how big would they be if I had
Bitcode turned on?

That said, the actual Swift binary is still larger. In my table view
example, the Objective-C binary is 144 KB and the Swift binary is 201
KB. *That's
still a 40% increase*. Obviously it's much harder to test a large-scale
app, but I'd like to know the percentage increase to expect if we were to
migrate to Swift.

On Wed, Jun 15, 2016 at 5:04 PM Saagar Jha <saagarjha28 at gmail.com> wrote:

> Yep, I just took a simple app and opened up the ipa. 90% of it is the
> “Frameworks” directory containing the Swift frameworks libSwiftCore.dylib,
> libSwiftDarwin.dylib, etc.
>
>
> On Wed, Jun 15, 2016 at 3:43 PM Seth Friedman via swift-users <
> swift-users at swift.org> wrote:
>
>> 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
>>
>>
>> _______________________________________________
>> swift-users mailing list
>> swift-users at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
>>
> --
> -Saagar Jha
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160616/0d724472/attachment.html>


More information about the swift-users mailing list