[swift-dev] Swift compile times comparison: frameworks vs. non-frameworks

Samantha John sam at gethopscotch.com
Tue May 31 17:39:31 CDT 2016


Hi all,

In my continued investigation of Swift compile times I was able to gather
some interesting data.

In the last couple weeks we decided to put in a large dev effort to move
our entire codebase into frameworks. We'd been having really slow build
times (often 5 minutes for an incremental compile, 12 minutes for a clean
build) and decided it was worth the effort to clean it up.

I had expected that moving code into frameworks would substantially speed
up the incremental compile time, but didn't expect it to speed up the clean
compile. To my surprise, it sped up the incremental compile to less than a
minute in most cases and just a little over 2 minutes for a clean build.

Investigating further, I added the -debug-time-function-bodies flag and
parsed out the build times for individual functions- following the
instructions from: http://irace.me/swift-profiling Looking at our code pre-
and post- frameworks move (and pre-frameworks actually had about 10% of the
code in frameworks) I got the following results:

*Pre-frameworks:*

9842 functions compiled.

1463 unique functions compiled

8379 of the functions compiled were duplicates

*Post-frameworks:*

2805 functions compiled.

1288 unique functions compiled

1517 of the functions compiled were duplicates
So first, just want to say, that the frameworks solution really worked. It
has resulted in a huge increase in productivity, and I like our codebase
better. It's made me love Swift again.

I'm wondering though: is this a known/expected result? I was pretty
surprised by the amount of duplicated compiles but I'm not experienced in
this area so maybe that's normal. Would love any clarification on how this
works.

Thanks so much!
Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160531/114bfb22/attachment.html>


More information about the swift-dev mailing list