xcode-build-benchmark
avdlee/xcode-build-optimization-agent-skill
Benchmark Xcode clean and incremental builds with repeatable inputs and timestamped artifacts.
What is xcode-build-benchmark?
Measure Xcode build performance before and after optimization attempts. This skill captures clean builds, cached clean builds, zero-change builds, and optional incremental builds with file touches, producing median timings and detailed timing summaries for comparison.
- Runs 3 clean builds and reports median, min, max timing
- Runs 3 cached clean builds when compilation cache is enabled
- Measures zero-change build overhead (fixed per-build cost)
- Optionally benchmarks incremental builds with file touches
- Saves timestamped JSON artifacts to .build-benchmark/ directory
- Reports biggest timing-summary categories and environment details
How to install xcode-build-benchmark
npx skills add https://github.com/avdlee/xcode-build-optimization-agent-skill --skill xcode-build-benchmark- Xcode project or workspace
- Python 3 for running benchmark_builds.py helper script
- Confirmed workspace/project path, scheme, configuration, and destination
How to use xcode-build-benchmark
- 1.Provide workspace or project path, scheme, configuration, and destination (e.g., simulator or device)
- 2.Run the benchmark command (typically via benchmark_builds.py helper)
- 3.Review the timestamped JSON artifact in .build-benchmark/ for median timings and timing summaries
- 4.Compare results across multiple runs or configurations to identify performance changes
- 5.Hand off artifact to xcode-compilation-analyzer or xcode-project-analyzer if optimization guidance is needed
Use cases
- Establish a performance baseline before attempting build optimizations
- Compare build times before and after code or configuration changes
- Identify whether clean builds or incremental builds are the bottleneck
- Measure the impact of compilation cache on clean build times
- Quantify fixed per-build overhead from scripts, codesigning, and validation
- iOS/macOS developers optimizing build times
- Build engineers measuring build performance regressions
- Teams comparing build performance across branches or configurations
xcode-build-benchmark FAQ
Always measure before recommending or making changes. Establish a baseline first, then rerun the same benchmark after changes to compare results.
A zero-change build runs immediately after a successful build with no source edits. It measures fixed overhead (dependency computation, build description creation, scripts, codesigning). If it takes more than a few seconds, there is avoidable per-build overhead.
Cached clean builds are run only when COMPILATION_CACHE_ENABLE_CACHING = YES is detected. They measure clean build time with a warm compilation cache, simulating realistic scenarios like branch switching or pulling changes. Pass --no-cached-clean to skip.
Use the --touch-file flag with a path to a representative source file (e.g., --touch-file path/to/SomeFile.swift). The benchmark will touch that file before each incremental build run.
If results show high variance, rerun under calmer conditions (fewer background processes, stable system state). Report the median and spread, not just the fastest single run.
Full instructions (SKILL.md)
Source of truth, from avdlee/xcode-build-optimization-agent-skill.
name: xcode-build-benchmark
description: Benchmark Xcode clean and incremental builds with repeatable inputs, timing summaries, and timestamped .build-benchmark/ artifacts. Use when a developer wants a baseline, wants to compare before and after changes, asks to measure build performance, mentions build times, build duration, how long builds take, or wants to know if builds got faster or slower.
Xcode Build Benchmark
Use this skill to produce a repeatable Xcode build baseline before anyone tries to optimize build times.
Core Rules
- Measure before recommending changes.
- Capture clean and incremental builds separately.
- Keep the command, destination, configuration, scheme, and warm-up rules consistent across runs.
- Write a timestamped JSON artifact to
.build-benchmark/. - Do not change project files as part of benchmarking.
Inputs To Collect
Confirm or infer:
- workspace or project path
- scheme
- configuration
- destination
- whether the user wants simulator or device numbers
- whether a custom
DerivedDatapath is needed
If the project has both clean-build and incremental-build pain, benchmark both. That is the default.
Worktree Considerations
When benchmarking inside a git worktree, SPM packages with exclude: paths that reference gitignored directories (e.g., __Snapshots__) will cause xcodebuild -resolvePackageDependencies to crash. Create those missing directories before running any builds.
Default Workflow
- Normalize the build command and note every flag that affects caching or module reuse.
- Run one warm-up build if needed to validate that the command succeeds.
- Run 3 clean builds.
- If
COMPILATION_CACHE_ENABLE_CACHING = YESis detected, run 3 cached clean builds. These measure clean build time with a warm compilation cache -- the realistic scenario for branch switching, pulling changes, or Clean Build Folder. The script handles this automatically by building once to warm the cache, then deleting DerivedData (but not the compilation cache) before each measured run. Pass--no-cached-cleanto skip. - Run 3 zero-change builds (build immediately after a successful build with no edits). This measures the fixed overhead floor: dependency computation, project description transfer, build description creation, script phases, codesigning, and validation. A zero-change build that takes more than a few seconds indicates avoidable per-build overhead. Use the default
benchmark_builds.pyinvocation (no--touch-fileflag). - Optionally run 3 incremental builds with a file touch to measure a real edit-rebuild loop. Use
--touch-file path/to/SomeFile.swiftto touch a representative source file before each build. - Save the raw results and summary into
.build-benchmark/. - Report medians and spread, not just the single fastest run.
Preferred Command Path
Use the shared helper when possible:
python3 scripts/benchmark_builds.py \
--workspace App.xcworkspace \
--scheme MyApp \
--configuration Debug \
--destination "platform=iOS Simulator,name=iPhone 16" \
--output-dir .build-benchmark
If you cannot use the helper script, run equivalent xcodebuild commands with -showBuildTimingSummary and preserve the raw output.
Required Output
Return:
- clean build median, min, max
- cached clean build median, min, max (when COMPILATION_CACHE_ENABLE_CACHING is enabled)
- zero-change build median, min, max (fixed overhead floor)
- incremental build median, min, max (if
--touch-filewas used) - biggest timing-summary categories
- environment details that could affect comparisons
- path to the saved artifact
If results are noisy, say so and recommend rerunning under calmer conditions.
When To Stop
Stop after measurement if the user only asked for benchmarking. If they want optimization guidance, hand off the artifact to the relevant specialist by reading its SKILL.md and applying its workflow to the same project context:
xcode-compilation-analyzerxcode-project-analyzerspm-build-analysisxcode-build-orchestratorfor full orchestration
Additional Resources
- For the benchmark contract, see references/benchmarking-workflow.md
- For the shared artifact format, see references/benchmark-artifacts.md
- For the JSON schema, see schemas/build-benchmark.schema.json
Related skills
More from avdlee/xcode-build-optimization-agent-skill and the wider catalog.

xcode-build-fixer
Apply approved Xcode build optimizations and verify improvements with benchmarking.

xcode-build-orchestrator
End-to-end Xcode build optimization: benchmark, analyze, prioritize, approve, fix, and re-benchmark.

xcode-compilation-analyzer
Analyze Swift compile hotspots and generate source-level optimization recommendations from build timing data.

xcode-project-analyzer
Audit Xcode project configuration, build settings, and schemes to identify build-time improvements with approval gates.

bkt
Bitbucket CLI for Data Center and Cloud. Use when users need to manage repositories, pull requests, branches, issues, webhooks, or pipelines in Bitbucket. Triggers include "bitbucket", "bkt", "pull request", "PR", "repo list", "branch create", "Bitbucket Data Center", "Bitbucket Cloud", "keyring timeout".

html-to-pdf
Convert HTML to PDF with pixel-perfect rendering and excellent Hebrew/RTL support. Use when the user asks to 'convert HTML to PDF', 'generate PDF from HTML', 'create PDF from webpage', 'export to PDF', or needs PDF generation with Hebrew text support.