Long compilation times

Hi all,

We're suffering from very long Swift compilation times in our project. Each
file takes ~1 second to compile (-Onone), (measured with xctool -jobs 1),
which is hitting our development experience as we keep adding swift code
(~350 .swift files) :(

I've gone through all the googling already and the
debug-time-function-bodies thing, but I didn't find any particular function
taking too long. However, I did notice:
a) Each file takes more or less the same amount of time to compile (~1
second), even for very simple files.
b) Each "swift -frontend -c" command with the debug-time-function-bodies
dumps basically the same info for each file, which is around 1500 lines.
Most of the times are 0.0ms, and the total sum for a random choice gave me
167.3 ms, far away from 1 second

From a) and b) looks like the same heavy operation is being performed for

each file (type checking?) and that this heavy operation grows with the
size of the project. Would it be possible to do this upfront and not pay
for it in every file? Basically, if I have 3 classes in one file it will
take 1 second to compile them but if I do 1 file per class then it will be
3 seconds :(

I'd like some input to whether my assumption is correct and suggestions on
how to improve the compilation time, apart from splitting the code into
smaller frameworks. Can I expect improvements with Swift 3 or future
releases? (I tried migrating a small framework to Swift 3 and didn't see a
big difference)

Cheers,
Diego

Hi all,

We're suffering from very long Swift compilation times in our project. Each file takes ~1 second to compile (-Onone), (measured with xctool -jobs 1), which is hitting our development experience as we keep adding swift code (~350 .swift files) :(

I've gone through all the googling already and the debug-time-function-bodies thing, but I didn't find any particular function taking too long. However, I did notice:
a) Each file takes more or less the same amount of time to compile (~1 second), even for very simple files.
b) Each "swift -frontend -c" command with the debug-time-function-bodies dumps basically the same info for each file, which is around 1500 lines. Most of the times are 0.0ms, and the total sum for a random choice gave me 167.3 ms, far away from 1 second

From a) and b) looks like the same heavy operation is being performed for each file (type checking?) and that this heavy operation grows with the size of the project. Would it be possible to do this upfront and not pay for it in every file? Basically, if I have 3 classes in one file it will take 1 second to compile them but if I do 1 file per class then it will be 3 seconds :(

I'd like some input to whether my assumption is correct and suggestions on how to improve the compilation time, apart from splitting the code into smaller frameworks. Can I expect improvements with Swift 3 or future releases? (I tried migrating a small framework to Swift 3 and didn't see a big difference)

Do you have a small example of this? Can you file a bug on bugs.swift.org <Issues · apple/swift · GitHub?

Then we can look at your specific example.

···

On Aug 19, 2016, at 9:23 PM, Diego Sánchez via swift-users <swift-users@swift.org> wrote:

Cheers,
Diego

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

I haven't been able to synthesise a project where this reproduces that
badly *yet*. Anyways I've filled [SR-2461] Long compilation times with bridging header and 100s of .swift files · Issue #45066 · apple/swift · GitHub with
some more info in case it helps.

Thanks!

···

2016-08-22 21:47 GMT+01:00 Michael Gottesman <mgottesman@apple.com>:

On Aug 19, 2016, at 9:23 PM, Diego Sánchez via swift-users < > swift-users@swift.org> wrote:

Hi all,

We're suffering from very long Swift compilation times in our project.
Each file takes ~1 second to compile (-Onone), (measured with xctool -jobs
1), which is hitting our development experience as we keep adding swift
code (~350 .swift files) :(

I've gone through all the googling already and the
debug-time-function-bodies thing, but I didn't find any particular function
taking too long. However, I did notice:
a) Each file takes more or less the same amount of time to compile (~1
second), even for very simple files.
b) Each "swift -frontend -c" command with the debug-time-function-bodies
dumps basically the same info for each file, which is around 1500 lines.
Most of the times are 0.0ms, and the total sum for a random choice gave me
167.3 ms, far away from 1 second

From a) and b) looks like the same heavy operation is being performed for
each file (type checking?) and that this heavy operation grows with the
size of the project. Would it be possible to do this upfront and not pay
for it in every file? Basically, if I have 3 classes in one file it will
take 1 second to compile them but if I do 1 file per class then it will be
3 seconds :(

I'd like some input to whether my assumption is correct and suggestions on
how to improve the compilation time, apart from splitting the code into
smaller frameworks. Can I expect improvements with Swift 3 or future
releases? (I tried migrating a small framework to Swift 3 and didn't see a
big difference)

Do you have a small example of this? Can you file a bug on bugs.swift.org?

Then we can look at your specific example.

Cheers,
Diego

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users