Skip to content

[6.0] Cherry-pick a couple of compile-time performance optimizations #76151

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

Merged

Conversation

slavapestov
Copy link
Contributor

6.0 cherry-pick of #75210 and #75164

  • Description: Profiling revealed a couple of hot spots where we were needlessly iterating over all source files in the main module.

  • Scope of the issue: Long compile times with projects having a large number of source files.

  • Origination: The bottleneck in isImportedAsWeakLinked() was introduced in Swift 5.8. The bottleneck in collectLinkLibraries() was introduced in Swift 4.2 or even earlier.

  • Risk: Low.

  • Tested: Existing tests passed, and profiling showed the methods in question no longer contribute to compile time.

  • Reviewed by: @hborla

@slavapestov slavapestov requested a review from a team as a code owner August 29, 2024 16:13
SourceFile::collectLinkLibraries() did not depend on the source file,
so let's move this logic up into ModuleDecl::collectLinkLibraries().
@slavapestov slavapestov force-pushed the compiler-perf-fixes-6.0 branch from 8676d58 to a95040c Compare August 29, 2024 16:14
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov slavapestov merged commit f8e35f0 into swiftlang:release/6.0 Aug 30, 2024
7 checks passed
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.

2 participants