Skip to content

Improve build performance with Xcode build settings and deterministic SPM pins#216

Open
AvdLee wants to merge 1 commit intogluonfield:mainfrom
AvdLee:build-performance-optimizations
Open

Improve build performance with Xcode build settings and deterministic SPM pins#216
AvdLee wants to merge 1 commit intogluonfield:mainfrom
AvdLee:build-performance-optimizations

Conversation

@AvdLee
Copy link
Copy Markdown

@AvdLee AvdLee commented Mar 23, 2026

Summary

This PR enables recommended Xcode build settings and pins branch-tracked SPM dependencies to specific revisions for faster, more deterministic builds.

Changes

  • COMPILATION_CACHING = YES (Debug + Release): Caches compilation results so repeated builds of unchanged sources are served from cache. The biggest wins come from branch switching, pulling changes, and CI builds where many files remain unchanged between builds.
  • EAGER_LINKING = YES (Debug): Allows the linker to start work before all compilation tasks finish, reducing wall-clock build time during development.
  • Pin Magnet, Splash, and OllamaKit from branch tracking (main/master) to specific commit revisions: Eliminates non-deterministic SPM resolution and avoids unnecessary re-fetches when upstream branches move.

Benchmark (Xcode 26.2, Apple Silicon)

Metric Before After
Clean build 19.4s 16.6s
Cached clean -- 16.8s
Zero-change 2.5s 2.2s

Cached clean = clean build with a warm compilation cache. This is the realistic scenario for branch switching, pulling changes, or Clean Build Folder. The compilation cache lives outside DerivedData and survives product deletion.

How these were found

Analysis was performed using Xcode Build Optimization Agent Skills (not yet available, happy to invite to the private repo!), which benchmarks builds, audits project settings against best practices, and identifies optimization opportunities.

Test plan

  • Project builds successfully with all changes
  • SPM dependencies resolve correctly with pinned revisions
  • No type-checking hotspots found above 100ms threshold
  • Benchmarked before and after changes

… SPM pins

Enable recommended Xcode build settings and pin branch-tracked SPM
dependencies to specific revisions for deterministic builds.

Changes:
- Enable COMPILATION_CACHING = YES (Debug + Release): caches compilation
  results so repeated builds of unchanged sources are served from cache.
  Benefits branch switching, pulling changes, and CI builds.
- Enable EAGER_LINKING = YES (Debug): allows the linker to start before
  all compilation tasks finish, reducing wall-clock build time.
- Pin Magnet, Splash, and OllamaKit from branch tracking to specific
  commit revisions: eliminates non-deterministic SPM resolution and
  avoids unnecessary re-fetches when upstream branches move.

Benchmark (Xcode 26.2, Apple Silicon):
- Clean build: 19.4s → 19.1s
- Zero-change: 2.5s → 2.5s

The compilation cache benefit is most significant during real developer
workflows (branch switching, incremental builds after pulling changes)
rather than clean-build benchmarks, where the cache is cold.
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