Swift.org Blog Johannes Weiss Oct 6, 2025

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

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.

The article reveals exactly how Apple uses this tool in two distinct ways across their infrastructure, plus the specific constraints that forced them to build it.

About This Article

Problem

Apple's distributed systems infrastructure on macOS and in sandboxed environments couldn't use traditional profiling tools like eBPF and DTrace. This made it hard to find performance bottlenecks in their latency-sensitive build and test infrastructure.

Solution

Johannes Weiss and Mitchell Allison's team built Swift Profile Recorder, an in-process sampling profiler distributed as a Swift Package. It collects samples through HTTP endpoints without needing kernel-level privileges or external system components.

Impact

Swift Profile Recorder works across different compute environments like Kubernetes and lambda functions. It outputs to industry-standard formats including Linux perf script, pprof, and FlameGraph collapsed format, which can be visualized in Speedscope and Firefox Profiler.