Re: [realm-cocoa] Archiving a project with realm swift adds 40MB to the binary

163 views
Skip to first unread message

Marius Rackwitz

unread,
Nov 2, 2015, 11:41:19 AM11/2/15
to Marc Rollin, realm...@googlegroups.com
Hey Marc,

to have a significantly bigger size than 1MB displayed in the organizer / finder after archiving isn't that unexpected, especially when you use both, RealmSwift.framework and Realm.framework.

Considering the size of the download and occupied on the device of the user, this will be actually a lot smaller. That's because Apple has introduced different mechanism as App Thinning to be able to optimize the download and installation size. One of this is Slicing, where irrelevant architectures will be removed and only the one relevant architecture for the user's CPU will been kept in the app variant, which is delivered. With Bitcode they are able to do further size reductions - but this most be supported by all uploaded binaries, which adds up extra size.

The dynamic Realm.framework in 0.96.2 is 34.1 MB. Of this, 20.1 MB is bitcode, and 7 MB is symbols for the simulator. The latter should be removed. The remaining 5 MB is the only part that actually ends up in your app, and that's cut in half by app slicing (since it has armv7 and arm64 symbols). Statically linking Realm.framework cuts it a bit further, but that's unfortunately not supported by Swift.

Hope this helps!

--
Marius Rackwitz
iOS Product Engineer


On Mon, Nov 2, 2015 at 1:30 PM UTC, Marc Rollin <rolli...@gmail.com> wrote:
When looking at the FAQ, it says that Realm should only add around 1MB to the size of my app.

How big is the Realm library?
Once your app is built for release, Realm should only add around 1MB to its size. The releases we distribute are significantly larger because they include support for the iOS and watchOS simulators, some debug symbols, and bitcode, which are all stripped by Xcode automatically when you build your app.

However, both using Carthage or Cocoapod (on a swift project), I end up with an overhead of around 40MB.

I can't figure out what I am doing wrong.

Any idea?
--
You received this message because you are subscribed to the Google Groups "Realm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to realm-cocoa...@googlegroups.com.
To post to this group, send email to realm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/realm-cocoa/4853aa9a-2912-445b-b73d-f9b9aba9be99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



{#HS:135458931-2179#}

Marc Rollin

unread,
Nov 2, 2015, 11:47:43 AM11/2/15
to Marius Rackwitz, realm...@googlegroups.com

Marius,

Thank you very much for your detailed explanations.
I now, have a better sense of the situation.

Best,

-- 
Marc Rollin
Reply all
Reply to author
Forward
0 new messages