Longer compilation times with Xcode 10.2 Swift 5?

Has anyone else noticed longer compilation times with Xcode 10.2 and Swift 5 (compared to Xcode 10.1, Swift 4.2), especially release builds?

There's a known regression tracked as SR-10249; you can try the toolchain linked here to see if it solves your problem.

1 Like

Is there no CI infrastructure dedicated to overall build performance testing?

1 Like

There is some, but it’s always possible to write code that’s different from what we have in our benchmark suite. That bug showed huge regressions on files that contained a large number of type declarations (because a verifier was doing quadratic work re-verifying all the metadata and other global structures), and we weren’t tracking anything like that.

2 Likes

Is that just implicit typing, or just a number of types in general? Would explicit typing work around the issue?

No, I mean like struct and enum declarations.

What counts as a large number here? 5, 20, 100?

From the compilers perspective is 1 type decelaration per file optimal?

Please don't rework your code around this; it's just a bug that we're working on delivering a fix for as soon as we can. There are toolchains you can use in the short term if it's causing serious problems for you.

3 Likes

Can anything be said about when (approximately) this fix will be in an Xcode GM?

We are actively integrating important fixes for issues found in the latest Swift/Xcode release. We fully understand the criticality of providing a fix to this issue as quickly as possible.

3 Likes

I assume this fix is what is included in the just released Xcode 10.2.1?

3 Likes

Xcode 10.2.1 worked for us we has a similar issue with huge Apollo generated graphQL swift files that wouldn't compile and now they build just fine

2 Likes

How come this issue (and maybe a couple of other ones) wasn't found before the release of Xcode 10.2 though?

Are some (afaics fairly basic) regression tests missing?

Didn't anybody notice (or bother to file a bug for) it during the betas?

Doesn't Apple have at least a couple moderately sized Swift Projects that they try to build before releasing the next Xcode GM?

Am I the only one who is a bit baffled (and frustrated) by this?

2 Likes

Things sometimes slip through regression testing, it happens. I wouldn't get overly frustrated or baffled by this. We can only hope that a test case has been added to their regression plan that will keep this from popping up again.

2 Likes

Well, the thing is that based on my experience with Swift and Xcode, I think maybe it hasn't. (Has it?)

And at least part of the regression in build time hasn't been fixed by Xcode 10.2.1, see here.

Instead of thinking “sure, of course there are tests for that, at least now”, I’m just feeling more and more like a full time Swift/Xcode forever-beta tester and bug/workaround-detective, and less and less like a productive app developer, and it saddens me that it hasn’t gotten noticeably better after all these years, which I really thought it would.

It’s still common to see seemingly basic and very noticeable non-niche stuff be more or less broken in a GM, and we have to deal with them for months on end.