Introducing Swift Profile Recorder: Identifying Performance Bottlenecks in Production
Article Summary
Apple just open-sourced the profiling tool they've used for years to debug Swift services at massive scale. No special privileges, no eBPF, no system dependencies required.
Swift Profile Recorder is an in-process sampling profiler that runs as a Swift Package, enabling performance profiling in sandboxed and restricted environments where traditional tools like eBPF or DTrace can't operate. Apple has battle-tested it across their latency-sensitive build infrastructure that powers OS development.
Key Takeaways
- Add profiling with just a package dependency, works in sandboxed environments
- Collect samples via curl over HTTP, no need to learn perf or eBPF
- Outputs to industry formats: perf script, pprof, FlameGraph collapsed format
- Apple uses it for both isolated performance regressions and continuous profiling
- Works on macOS and Linux without extra privileges or system components
Critical Insight
Swift services can now profile production performance bottlenecks in restricted environments where traditional profiling tools can't run, using only a Swift Package and curl.