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-7366] Very slow compile of one line of code #49914

Closed
swift-ci opened this issue Apr 6, 2018 · 4 comments
Closed

[SR-7366] Very slow compile of one line of code #49914

swift-ci opened this issue Apr 6, 2018 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself performance type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Apr 6, 2018

Previous ID SR-7366
Radar None
Original Reporter smartgo (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

iMac 5K late 2014, macOS High Sierra 10.13.3, Xcode 9.3 (9E145).

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Performance, TypeChecker
Assignee None
Priority Medium

md5: fbd684c61804af7169745e9aead6c486

Issue Description:

The following Swift code compiles very slowly (8 seconds):

let a = 1

let b = a + (a << 4) + (a << 8) + (a << 13)

When adding one more term to this, the compiler complains that the expression is too complex.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Apr 6, 2018

Comment by Anders Kierulf (JIRA)

No need for any variables, the following line brings the playground to its knees:

let _ = 1 + (1 << 4) + (1 << 8) + (1 << 12)

Add one more term and it's too complex. Please figure out what's going on here.

@belkadan
Copy link
Contributor

belkadan commented Apr 6, 2018

Seems to be much better on master! @xedin, @rudkx, is there a particular fix you can point to, or should this just be moved to Resolved?

@xedin
Copy link
Member

xedin commented Apr 6, 2018

smartgo (JIRA User) Thanks for the report, we are working on trying to optimize performance of chained operators (with literals) and we have multiple examples like this in our performance suite...

@belkadan I think what might have helped in this particular case is that shifts have multiple unavailable overloads and I've made a change to only check them when we know that there is no other possible solution.

@xedin
Copy link
Member

xedin commented Apr 6, 2018

Going to resolve this is a duplicate since we have multiple JIRAs already for this problem.

@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
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself performance type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants