Airbnb's Page Performance Score on iOS
Article Summary
Airbnb built a unified performance scoring system that works across all platforms. Here's how they instrumented it on iOS to track real user experience at scale.
Nicholas Miller from Airbnb's engineering team breaks down their Page Performance Score (PPS) implementation on iOS. This is part 3 of their series on measuring performance across web and mobile using consistent, user-centric metrics.
Key Takeaways
- Built PPSStateMachine class to handle all metric tracking and edge cases automatically
- Measures 5 key metrics: TTFL, TTIL, scroll thread hangs, additional load time, and rich content load
- Uses monotonic clock in nanoseconds for precision, avoiding casting errors
- Skipped main thread hang tracking after tests showed battery drain without added insight
- Engineers only provide page name and content state, infrastructure handles the rest
Airbnb created a standardized iOS performance tracking system that gives engineers real user metrics without complex instrumentation work.
About This Article
Airbnb needed to measure performance across iOS pages with nanosecond precision, but converting between time scales kept introducing casting errors that made the data less accurate.
Nicholas Miller's team created typealiases for UInt64 nanoseconds and Float64 milliseconds. This forced developers to think explicitly about time scale conversions. They used computed variables to return the current time in milliseconds.
Engineers can now log performance events without writing their own time conversion logic. This cuts down on implementation errors and gives them consistent millisecond-precision metrics across iOS features.