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-14622] Slow (2s) code completion doing unresolved member completion inside result builder #56974

Closed
ahoppen opened this issue May 11, 2021 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code completion Area → source tooling: code completion performance source tooling Area: IDE support, SourceKit, and other source tooling

Comments

@ahoppen
Copy link
Contributor

ahoppen commented May 11, 2021

Previous ID SR-14622
Radar rdar://77837146
Original Reporter @ahoppen
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug
Assignee @ahoppen
Priority Medium

md5: f52b3af22b0c110b4ce74ccff55a09c3

Issue Description:

$ cat ~/Desktop/test.swift
import SwiftUI

struct ContentView: View {
    var body: some View {
        ZStack {
            if let status = Warning.which {
                RoundedRectangle(cornerRadius: 10)
                    .foregroundColor(status == .three ? Color.red : status == .two ? Color.yellow : Color.white)
            }
        }
        #^COMPLETE^#
    }
}

enum Warning {
    case one
    case two
    case three

    static var which: Warning {
        fatalError()
    }
}
$ time ./swift-ide-test --code-completion -source-filename ~/Desktop/test.swift -sdk /Applications/Xcode-GPE.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk -target x86_64-apple-ios14.0-simulator -code-completion-token=COMPLETE > /dev/null
found code completion token COMPLETE at offset 326
________________________________________________________
Executed in    2.15 secs   fish           external 
   usr time    1.95 secs  110.00 micros    1.95 secs 
   sys time    0.19 secs  1009.00 micros    0.19 secs 
@ahoppen
Copy link
Contributor Author

ahoppen commented May 11, 2021

The culprit here appears to be the nested use of ternary operators in .foregroundColor. When running swift-ide-test with -debug-constraints, it is trying all sorts of different overloads for ==.

This might be fixed by https://bugs.swift.org/browse/SR-14601.

@ahoppen
Copy link
Contributor Author

ahoppen commented Apr 4, 2022

The performance issue has been resolved by my recent migration of code completion to solver-based, most likely #41846

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the source tooling Area: IDE support, SourceKit, and other source tooling label Feb 6, 2023
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. code completion Area → source tooling: code completion performance source tooling Area: IDE support, SourceKit, and other source tooling
Projects
None yet
Development

No branches or pull requests

2 participants