Skip to content

[Incremental Builds]optimize performance for ModuleDependencyGraph by reducing the number of external dependencies from N*M to N+M #1881

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

WeijunDeng
Copy link

Swift driver version

swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Target: arm64-apple-macosx14.0

Backgound

A swift module has 2500 swift files and 10000 external dependencies. These external dependencies include over 100 swift modules, along with a majority of header files. Thus, the graph.nodeFinder.usesByDef has 2500 * 10000 nodes of external dependencies,slowing down the Incremental build speed.

Improvement

  swift-driver total duration planBuild run(jobs:) .priors file size nodes number of external dependencies
Before optimization 33s 24.61s 6.11s 162M N * M
After optimization 12s 8.50s 2.10s 53M N + M
Optimization improvement 63.6% 65.5% 65.6% 67.3%  -

… reducing the number of external dependencies from N*M to N+M
@WeijunDeng
Copy link
Author

@swift-ci Please test

@WeijunDeng
Copy link
Author

@swift-ci Please benchmark

@WeijunDeng WeijunDeng changed the base branch from main to release/6.2 April 23, 2025 09:21
@WeijunDeng WeijunDeng requested a review from a team as a code owner April 23, 2025 09:21
@WeijunDeng WeijunDeng changed the base branch from release/6.2 to main April 23, 2025 09:23
@WeijunDeng
Copy link
Author

@artemcm @cachemeifyoucan please review

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.

1 participant