Perf tests VS anomalies. The eternal battle for application performance on iOS

Pavel Vorobkalov19 Sep 2023

Problem

A mobile team ships changes every week, and any of them can slow startup, page loading or CPU use unnoticed. Production telemetry shows the damage late and mixes app versions across different devices. A device bench is stable, but each metric still fluctuates, so one run proves nothing. Yandex measured that a 10% slower startup costs 1% of retention, and a Google article reports that 400 ms of extra loading cuts searches through the app by 0.44%.

Example from the article: a fix for flickering placeholders in the Yandex iOS app made the perf system open a ticket with a list of degraded metrics. The fix made placeholders get recreated on every use, and an LRU cache for placeholders recovered the drop.

Solution in brief

Run repeated perf tests of key scenarios (startup, search page) on a device bench. Warm the device up, replay recorded network responses and compare builds with a statistical test. Fold the startup metrics into one 0–100 index and watch the main branch with automatic bisect, so each anomaly, good or bad, becomes a ticket for the author of one commit.

Questions this case answers
  • How to detect statistically valid performance regressions of a frequently changing client application before release and attribute each one to a single change when measurements are noisy
  • How to decide whether to accept a change when several performance metrics move in opposite directions
  • How to catch a performance regression of a mobile app before release and trace it to one commit?
  • How to compare two app builds on a device bench when measurements are noisy and the phone heats up during the run?

Tools and methods

  • XCTest, os_signpost, custom TCP metrics — collect launch time, CPU, RAM and Time to Interactive
  • Chromium Catapult — statistical comparison and charts
  • Web Page Replay — replays recorded HTTP(S) responses
  • Mobile Velocity Index (MVI) — one score for FCP, LCP and TTI
  • Firebase Performance Monitoring — production telemetry
Continue reading — it's free

Google or a one-time email code. No password.