[swift-dev] Reduce app startup time by combining swift-libs

Alex Blewitt alblue at apple.com
Mon Feb 20 05:35:55 CST 2017

> On 17 Feb 2017, at 21:58, Michel Loenngren via swift-dev <swift-dev at swift.org> wrote:
> All,
> When starting an app that includes swift these libs are being loaded:
> libswiftCoreGraphics.dylib 
> libswiftDispatch.dylib     
> libswiftObjectiveC.dylib
> libswiftCore.dylib
> libswiftDarwin.dylib
> libswiftFoundation.dylib
> which adds considerable delay to our app startup time (compared to running a pure objective-c codebase). Is anybody aware of a way to reduce startup by combining these libs into a single lib for faster load time?

At the moment, these are provided as individual libraries because they are built as separate libraries on the command line. It's possible to build a static version of the core library with swiftc -static-stdlib on Darwin (there are still work in progress items for Linux and Foundation).

https://bugs.swift.org/browse/SR-730 <https://bugs.swift.org/browse/SR-730>

However, note that the majority of the libraries that you list are also used in a pure objective-c codebase; for example, running otool -L on Mail.app gives:


(Dispatch is embedded in libSystem on Darwin)

So the libraries you load are the same ones (in effect) to the ones used by your Objective-C application, in all likelihood. The difference is probably in the way that the libraries are set up and the dispatch once code is executed - which are necessary steps in bringing the Swift runtime up for your application.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170220/78c0dab8/attachment.html>

More information about the swift-dev mailing list