Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-305] Simple, legit literal takes exponentially growing compile time. #42927

dduan opened this issue Dec 18, 2015 · 4 comments

[SR-305] Simple, legit literal takes exponentially growing compile time. #42927

dduan opened this issue Dec 18, 2015 · 4 comments


Copy link

@dduan dduan commented Dec 18, 2015

Previous ID SR-305
Radar None
Original Reporter @dduan
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 6
Component/s Compiler
Labels Bug, TypeChecker
Assignee @jopamer
Priority Medium

md5: 671f0ac06627b6519c1b4f035d41c57c

Issue Description:

Run swiftc -dump-ast on this file, the compilation will never finish. Removing values gradually from the array and you'll notice that the shorter the expression, the less time it takes.


Copy link

@belkadan belkadan commented Dec 19, 2015

Dictionary of dictionaries of dictionaries of string-string mappings.

Copy link

@modocache modocache mannequin commented Apr 26, 2016

This appears to be a pain point. From

"Copy the above code into Xcode, press “build,” and go get a coffee. Come back in 12 hours. Yes, the above dictionary literal code takes at least 12 hours to compile. The compilation time grows roughly exponentially with each employee that is added."

A commenter on that article proposes speeding up the compilation by adding a type annotation:

let myCompany: [String: [String: [String: String]]]

Is this the best workaround right now?

Copy link

@belkadan belkadan commented Apr 26, 2016

Type annotations are always the first thing to reach for when an expression is taking a long time, yes.

Copy link

@jopamer jopamer commented Apr 27, 2016

Fixed in master with 2cdd7d6.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants