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

Swift package compile times are at least 2-3 times slower on Windows (sometimes much more) #8265

Open
1 task done
silverhammermba opened this issue Jan 31, 2025 · 1 comment
Labels

Comments

@silverhammermba
Copy link

silverhammermba commented Jan 31, 2025

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

I'm using https://github.com/swiftlang/swift-syntax as my test project. Results:

  • Windows swift build clean: 60s
  • Windows swift build incremental: 16s
  • Windows CMake+ninja build clean: 66s
  • Windows CMake+ninja build incremental: 28s
  • Linux swift build clean: 24s
  • Linux swift build incremental: 6s
  • Mac swift build clean: 42s
  • Mac swift build incremental: 6s

Note that my Windows machine is much more powerful than my Mac (see specs below), so the difference between those two is much worse than the numbers indicate.

I opened a new issue since #7943 was thought to be fixed.

Machine specs

  • Windows: AMD Ryzen 9 3900XT, Samsung SSD 970 EVO Plus 1TB, Windows 11 Home v23H2, 32G RAM
  • Linux: AMD Ryzen 9 3900XT, Samsung SSD 980 PRO 500GB, Arch Linux x86_64 kernel 6.12.10-arch1-1, 32G RAM
  • Mac: 2019 MacBook Pro. Intel i9, Apple SSD AP1024N, macOS Sequoia 15.2, 16GB RAM

Expected behavior

Windows build times should be somewhat similar to Mac and Linux build times for the same package.

Actual behavior

Windows build times are at least several times slower than expected, sometimes so slow as to be unusable for large/complex packages.

For example, https://github.com/migueldeicaza/SwiftGodot takes so long to build on my Windows machine that I have yet to see it ever complete. A clean build takes only 2 minutes on Linux.

Steps to reproduce

Build any Swift package on Windows with swift build.

CMake+ninja builds done via:

mkdir build
cd build
cmake .. -G Ninja -D CMAKE_Swift_FLAGS="-use-ld=lld"
Measure-Command { ninja | Out-Default }

Linux+Mac builds were just swift build.

Swift Package Manager version/commit hash

Swift 6.0.2-dev

Swift & OS version (output of swift --version ; uname -a)

Windows install via official winget instructions:

Swift version 6.0.2 (swift-6.0.2-RELEASE)
Target: x86_64-unknown-windows-msvc
Microsoft Windows 11 Home 10.0.22631 64-bit

Linux install via AUR:

Swift version 6.0.3 (swift-6.0.3-RELEASE)
Target: x86_64-unknown-linux-gnu
Linux eta 6.12.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 18 Jan 2025 02:26:57 +0000 x86_64 GNU/Linux

Mac Swift

swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: x86_64-apple-macosx15.0
Darwin PC16221.local 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec  6 18:41:43 PST 2024; root:xnu-11215.61.5~2/RELEASE_X86_64 x86_64
@silverhammermba silverhammermba changed the title Swift package compile times are orders of magnitude slower on Windows Swift package compile times are at least 2-3 slower on Windows (sometimes much more) Jan 31, 2025
@silverhammermba silverhammermba changed the title Swift package compile times are at least 2-3 slower on Windows (sometimes much more) Swift package compile times are at least 2-3 times slower on Windows (sometimes much more) Jan 31, 2025
@stackotter
Copy link

I'm glad it's not just me! I've had a feeling that my Windows builds were slower than my Linux builds on the same hardware, but never got around to backing up my gut feeling with benchmarks. Thanks for putting the work in and filing this issue 🙏

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

No branches or pull requests

2 participants