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

SwiftDriver performance fixes for swift caching #1825

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cachemeifyoucan
Copy link
Contributor

@cachemeifyoucan cachemeifyoucan commented Feb 27, 2025

When looking at the performance of swift-driver when doing a batch planning for a very large module including thousands of files, the cache key computation is the bottle neck for performance. This PR includes fixes to eliminate some of the inefficiencies in the swift-driver that can cause unnecessary cache key computations. This PR includes:

  • Eliminate the redundant batch job forming when using -enable-batch-mode -incremental
  • Eliminate the cache key computation when constructing the initial jobs which later will turn into batch jobs.
  • Make the bridging between swift [String] and C const char ** more efficient for swift scan interfaces.

rdar://145298257

@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@artemcm artemcm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Borrow the implementation from stdlib test for a faster way to bridging
swift `[String]` to `const char **`. Instead of strdup every string
which can be costly if the argument list is very long, use one single
big allocation to hold all the strings.
When using incremental build, the FirstWaveComputer has already batched
all the compile jobs. `planStandardCompile()` can just reuse the batch
job information from incremental state to construct the jobs.
@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-perf-for-caching branch from 2c8b812 to ccae5a1 Compare February 27, 2025 22:46
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

During batch mode, the initially computed compilation tasks will be
batched later. There is no need to compute cache keys for those Jobs
since they will not be executed.
@cachemeifyoucan cachemeifyoucan force-pushed the eng/PR-swift-driver-perf-for-caching branch from ccae5a1 to 5ea08fe Compare February 27, 2025 22:54
@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test

@cachemeifyoucan
Copy link
Contributor Author

@swift-ci please test windows platform

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