Skip to content

Refactor slow to type check expression #8565

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

plemarquand
Copy link
Contributor

Motivation:

An expression in SwiftRunCommand was taking almost 2 seconds to type check on my M4 MacBook.

Modifications:

Break it out in to multiple, faster to type check expressions.

Result:

This brings each individual expression down to under 80ms to check.

This was diagnosed with:

swift build \
  -Xswiftc -Xfrontend -Xswiftc -warn-long-function-bodies=80 \
  -Xswiftc -Xfrontend -Xswiftc -warn-long-expression-type-checking=80

@plemarquand
Copy link
Contributor Author

@swift-ci test

An expression SwiftRunCommand was taking almost 2 seconds to type check
on my M4 MacBook. Explicitly type the enum cases so the type checker has
less work to do. This brings the time to type this expression down to
under 80ms to check.

This was diagnosed with:

```
swift build \
  -Xswiftc -Xfrontend -Xswiftc -warn-long-function-bodies=80 \
  -Xswiftc -Xfrontend -Xswiftc -warn-long-expression-type-checking=80
```
@plemarquand plemarquand force-pushed the slow-typecheck-method branch from 1b73a99 to 34bff20 Compare April 28, 2025 18:27
@plemarquand
Copy link
Contributor Author

@swift-ci test

@plemarquand
Copy link
Contributor Author

@swift-ci test windows

@plemarquand
Copy link
Contributor Author

@swift-ci test windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants