Several blog posts have highlighted sluggish compile times associated with Swift code. I encountered this issue during a test case involving the creation of a relatively straightforward nested structure, leading me to suspect that type inference was the root cause.
In Xcode 6.1, the following code snippet takes an astonishing 40 seconds to compile:
swift
func hangCompiler() { ["A": [ ["B": [ 1, 2, 3, 4, 5 ]], ["C": [ ]], ["D": [ ["A": [ 1 ]] ]] ]] }
bash
/Applications/Xcode.app/.../usr/bin/swift -frontend -c -primary-file .../Perf.swift ...x86_64/Perf.o
swift
["A": [ ["B": [ 1, 2, 3, 4, 5 ]] as [String: [Int]], ["C": [ ]] as [String: [Int]], ["D": [ ["A": [ 1 ]] as [String: [Int]] ]] ]]