Skip to content

The simplest Package build takes 3s on M3 MacBook, and that is very slow #8614

Open
@krzyzanowskim

Description

@krzyzanowskim

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

it takes about ~3 seconds to build a Hello World, single target, no dependency package on M3 MacBook Air.

for comparison, raw swiftc file.swift execution takes 0.2s, that is 15 times faster.

❯ time swiftc Sources/asdf/Content.swift
swiftc Sources/asdf/Content.swift 0.25s user 0.07s system 122% cpu 0.263 total

SwiftPM build:

❯ cat Package.swift
// swift-tools-version:5.9
import PackageDescription

let package = Package(
    name: "asdf",
    platforms: [
        .macOS(.v14)
    ],
    products: [
        .executable(
            name: "asdf",
            targets: ["asdf"]),
    ],
    dependencies: [],
    targets: [
        .executableTarget(
            name: "asdf",
            dependencies: []),
    ]
)

❯ cat Sources/asdf/Content.swift
import Foundation

print("Hello World")

❯ rm -rf .build && time swift build --manifest-cache local --disable-prefetching  --use-integrated-swift-driver --disable-build-manifest-caching --disable-automatic-resolution --build-system native
Building for debugging...
[7/7] Applying asdf
Build complete! (3.14s)
swift build --manifest-cache local --disable-prefetching    --build-system   2.70s user 0.68s system 87% cpu 3.858 total

While some overhead is expected, the difference is worrisome.

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

swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0
Darwin MarcinK-MacBook.local 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:34:14 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T8122 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions