Wednesday, February 20, 2019

xCode 10 Swift 4.2 slow autocomplete and compile times. BAD.

At some point I started to have dismal swift autocomplete delays in xCode 10 and slower compile times. Having googled this and that and optimizing what I could I also found into these type of warnings:



My first guess was that longer tuples are causing the problem. I changed this part to use structs, no joy.

One more part in the code gave me another hint:



Looked to me as if just adding up literals via "+" would be tricky for swift compiler's type checking.

Changing everything above to String(format:) resolved the type checking speed.

If you ask on using string interpolation with \() - it didn't solve the problem. Plus I don't like these messy strings when they get longer.

I have no good words for the guys that work on Swift programming language and its design/tools. I don't think this part and types of optimization should really ever bother us, regular devs.

Bad, bad, bad.... I wish I could have loved Swift more. I love the language even if I don't think it is superior that much to Objective-C. Moving to it from Objective C with all new and updated stuff, but this is simply bad.

P.S. You can find a really good digest of Swift compile time optimizations here:

https://github.com/fastred/Optimizing-Swift-Build-Times

No comments: