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-12393] Slow type-checking for array literal containing bitshifts of int literals #54830

Open
swift-ci opened this issue Mar 21, 2020 · 3 comments

Comments

@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented Mar 21, 2020

Previous ID SR-12393
Radar rdar://problem/60832861
Original Reporter Tiza (JIRA User)
Type Bug
Environment

Catalina 10.15.4b6, Xcode 11.4 beta 3 (11N132i)

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

md5: aabb2b8bb59f18232a1855b1b0fcb431

Issue Description:

I've tried to translate a piece of C-Code to Swift and learned that bit shifts to fill arrays increases compile time exponentially.

let bitmask = [
 1<<0, 1<<0,
 1<<1, 1<<1,
 1<<2, 1<<2,
 1<<3, 1<<3
 ]

This compiles on a MacBook Pro i7 in 10s+ and one more line with two items doesn't compile anymore due to time out. Debug code size of this piece is more than 1KB.

@beccadax
Copy link
Contributor

@beccadax beccadax commented Mar 24, 2020

@swift-ci create

@beccadax
Copy link
Contributor

@beccadax beccadax commented Mar 25, 2020

This is an issue with type checker performance.

@beccadax
Copy link
Contributor

@beccadax beccadax commented Mar 25, 2020

Using -debug-constraints produces 165 MB of output, including:

---Solver statistics---
Total number of scopes explored: 127940
Maximum depth reached while exploring solutions: 28
Time: 5.291655e+04ms
Comparing 6561 viable solutions

Exponential behavior, anyone?

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

No branches or pull requests

2 participants