-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
build: selectively convert modules to static linking in CMake #8268
base: main
Are you sure you want to change the base?
Conversation
Please test with following PRs: @swift-ci please test Windows platform |
@swift-ci please smoke test Linux platform |
@swift-ci please smoke test macOS platform |
@swift-ci please test macOS platform |
@swift-ci please test Linux platform |
Please test with following PRs: @swift-ci please test |
Please test with following PRs: @swift-ci please test Windows platform |
Trying to grapple with the numbers. Don't the PackageModelSyntax Conversion numbers show things are bigger? Aside from that, I've been kinda confused by this whole exercises. Doesn't making things static libraries mean the code is copied into all the executables and DLLs that consume them, making the overall thing bigger? I'm trying to understand why it's smaller. Is it dead code that isn't used by anyone? |
Or is it test code that ends up in the DLL but not used by any of the exe's, only the tests? |
Yes! The first one alone would increase the size. However, as more collapsed later, it becomes smaller.
Yes, this is very much confusing. The code is copied. However, with static linking, we are able to perform DCE. Because the code is not uniformly used, the combination of that and all the indirection sometimes ends up with a smaller binary. I was trying to go further with this, but that seemed to always increase the size rather than decrease. It would be nice to split up the library code such that we can dynamically link a single library for SourceKit-LSP so that we do not increase the binary size. |
This adjusts the dependency graph to match the reality of the sources.
Convert a few libraries to static linking. This results in a net size reduction for the toolchain as a whole while also reducing the distributed DLLs. PackageModelSyntax Conversion: ~~~ Before: 6621696 sourcekit-lsp.exe 3844608 Commands.dll 144384 PackageModelSyntax.dll ------- 10610688 After: 6712320 sourcekit-lsp.exe 3950592 Commands.dll -------- 10662912 ~~~ Savings: 52,224 bytes SwiftSDKCommand Conversion: ~~~ Before: 23552 swift-sdk.exe 267776 SwiftSDKCommand.dll ------ 291328 After: 265728 swift-sdk.exe ~~~ Savings: 25,600 bytes CoreCommands Conversion: ~~~ Before: 3844608 Commands.dll 1065472 CoreCommands.dll 265728 swift-sdk.exe ------- 5175808 After: 4202496 Commands.dll 649728 swift-sdk.exe ------- 4852224 ~~~ Savings: 323,584 bytes DriverSupport Conversion: ~~~ Before: 945152 Build.dll 4202496 Commands.dll 49152 DriverSupport.dll 649728 swift-sdk.exe ------- 5846528 After: 958976 Build.dll 4217856 Commands.dll 669184 swift-sdk.exe ------- 5846016 ~~~ Savings: 512 bytes Net Savings: 401,920 bytes
@swift-ci please test |
@swift-ci please test Windows platform |
Please test with following PRs: @swift-ci please test Windows platform |
Convert a few libraries to static linking. This results in a net size
reduction for the toolchain as a whole while also reducing the
distributed DLLs.
PackageModelSyntax Conversion:
Savings: 52,224 bytes
SwiftSDKCommand Conversion:
Savings: 25,600 bytes
CoreCommands Conversion:
Savings: 323,584 bytes
DriverSupport Conversion:
Savings: 512 bytes
Net Savings: 401,920 bytes