Appending many arrays on one line in Swift causes very slow compilation times

Originator:xavier
Number:rdar://19740888 Date Originated:2015-02-05
Status:Open Resolved:
Product:SwiftC Product Version:Swift version 1.1 (swift-600.0.56.1)
Classification:Performance Reproducible:Always
 
Summary:
Appending more than 3 arrays on a single line causes very slow swiftc compilation times.

Steps to Reproduce:
1. Define 5 different Array<String> objects: e.g.
  let a = [“a”, “b”, “c”] 
  let b = [“d”, “e”, “f”] …

2. Define a new array that is the sum of all of these e.g.:
  let appended = a + b + c + d + e

Expected Results:
Sub-second compilation times.

Actual Results:
53 second compilation times

Notes:
I’ve attached a test swift file which can be compiled with “swiftc testcase.swift”, demonstrating the slow compilation times. If you only sum 4 objects in a line it’s an order of magnitude faster, if only 3, another order of magnitude, and so on

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!