Very slow compilation of `lazy var` properties


(Tadeas Kriz) #1

Hey everyone!

I spent last few days trying to bring down compilation time of our iOS
project, which has about 500 files and 50k lines (plus ~20 dependencies
precompiled into frameworks by Carthage).

I stumbled upon this http://irace.me/swift-profiling and wrote myself a
simple script that sums up all the times spent on various places in code.
To my surprise, I found out that many of the lines that took the most of
time to compile were simply `lazy var ` properties in classes. Is it unique
to our project (I mean caused by misconfiguration) or do you guys see this
as well?

Thanks!

Tadeas


(Zachary Waldowski) #2

Tadeas Kriz via swift-users <swift-users <at> swift.org> writes:

Hey everyone!
I spent last few days trying to bring down compilation time of our iOS
project, which has about 500 files and 50k lines (plus ~20 dependencies
precompiled into frameworks by Carthage).

I stumbled upon this http://irace.me/swift-profiling and wrote myself a simple
script that sums up all the times spent on various places in code. To my
surprise, I found out that many of the lines that took the most of time to
compile were simply `lazy var ` properties in classes. Is it unique to our
project (I mean caused by misconfiguration) or do you guys see this as well?

Thanks!

Tadeas

_______________________________________________
swift-users mailing list
swift-users <at> swift.org
https://lists.swift.org/mailman/listinfo/swift-users

I’ve identified this as well. It’s pretty severe in my current project, which is
of a similar size. Various sprinklings of “private”, “final”, and “@nonobjc
all seem to have no positive effect. Using the self-calling closure version
seems to exacerbate the problem.

Zachary