skip to content

In a music-streaming app, why can launches run slower right after an update, and what does a shipped startup-path profile change?

level: middleimportance: nice to knowfreq 38%

answer

  1. new code, not yet optimised
  2. interpreted first, compiled at idle later
  3. list the startup path in the package
  4. compiled at install, not days later
  5. compiling cannot speed up waiting

basics

~20 s

Where the runtime compiles app code on the device, updated code runs interpreted or compiled on the fly until the device optimises it later; a shipped startup-path profile lets that code be compiled ahead of time at install.

solid answer

~50 s

On one platform, app code is not fully compiled to machine code when installed: until the device gets round to it, code runs interpreted or is compiled **just in time**, and optimised compilation happens later in the background, typically when the device is idle. So after every install or update, the first launches run slower code. Shipping a **profile of the startup path**, a list of the code that launch and the first screens execute, lets that code be compiled **ahead of time** for every new user and every update; that platform's guidance reports gains of about 30% in code execution for the covered paths. Generate it per release from the journeys the launch budget measures. It speeds up running code, not waiting: a blocking network call or a disk read on the main thread costs the same compiled or not. Measure first launches after an update as their own segment.

go deeper

for a junior

Recall that on one platform new or updated app code runs unoptimised at first, and that a shipped startup profile lets the launch path be compiled ahead of time at install.

for a middle

Explain the mechanism: interpreted or just-in-time code until idle-time compilation, a profile captured from real startup journeys, ahead-of-time compilation of the listed code on install or update, regenerated per release.

for a senior

Place the lever in a launch plan: it speeds up code that runs, not waiting, it goes stale if not regenerated, and first launches after an update need their own field segment to show whether it works.

for a principal

Decide where it sits in the release process: profile generation owned by the pipeline, tied to the budgeted startup journeys, with the other platform's and the frameworks' levers tracked alongside.

## Why the first runs after an update can be slower A launch's cost is partly *how much* work runs and partly *how fast* that code executes. The second part depends on how the platform turns the app's code into machine instructions, and the platforms differ. On one platform, the app package carries code that the device's runtime compiles itself. Without help, freshly installed or updated code is first **interpreted** or **compiled just in time** in memory as it runs, and optimised compilation to stored machine code happens later, in the background, when the device is idle. That platform's guidance says it plainly: after installing or updating an app, users have a suboptimal experience from the first run until new code paths are optimised. For a music app updated every two weeks, a meaningful share of launches happen in that window. Other causes of slower first launches after an update are generic: caches written by the previous version may be discarded and rebuilt, and any one-time data upgrade adds its cost to that launch unless it is kept off the launch path. ## What a shipped startup profile changes A **startup profile** is a list of the classes and methods that the launch path and the first interactions execute. The mechanism: 1. Before release, the team drives the real startup journeys on a device: a cold launch from the icon, a launch from a notification, resuming the last track, opening a playlist. 2. The runtime's record of which code ran becomes the profile, stored in the app package. 3. On install or update, the platform uses it to compile the listed code **ahead of time**, so the first launch already runs optimised code for those paths, rather than waiting for idle-time compilation. The guidance frames this as **profile-guided optimisation** available from the first launch, done once per release on a development machine rather than discovered on each user's phone, and reports execution-speed gains of about 30% for the included paths. Treat that figure as the vendor's measurement, not a promise for your app. ## How the platforms and frameworks differ | Setting | Where launch code cost goes | The lever | |---|---|---| | One platform, a runtime that compiles on the device | first launches after install or update run unoptimised code | ship a startup profile so the path is compiled ahead of time | | The other platform | before any app code runs, the system loads the executable and its libraries; part of that is cached at install, and code marked to run at load time runs first | fewer third-party libraries, fewer load-time initialisers | | A cross-platform framework | its own engine or runtime starts on the cold path, with its own precompilation choices | the framework's startup tuning, on top of the native levers | The portable lesson is not the mechanism but the question: **what does the platform do with our code between install and the first launch, and what can we ship to help it?** ## What it cannot fix - **Waiting.** A launch slow because the main thread waits on a network reply, a lock or a disk read stays slow; compiling code faster does not shorten a round-trip. - **Too much work.** Eight SDKs set up before the first frame still run eight set-ups; the profile makes each a little faster, but deferring them removes them. - **A stale profile.** A profile lists the code of the build it was captured from. Start-up code that is renamed, moved or new is not in an old profile and runs uncompiled on first launches until the device catches up. So the order is: cut the path first, then use the profile to make what remains run at full speed from the first launch. ## Measuring it honestly - Keep **first launch after install or update** as its own segment in field launch metrics, so a new release's early percentiles are not misread as a code regression, or a missing profile as noise. - Compare that segment between a release with a fresh profile and one without; if the gap to later launches closes, the profile is working. - Generate the profile in the release pipeline from the same startup journeys the launch budget measures, so the code that is budgeted is the code that is precompiled.

  • Does a startup profile help if the startup path itself is bloated?
    Only partly. It makes the code that runs execute faster; it does not remove a blocking network call, a disk read on the main thread or eight SDK set-ups. Waiting costs the same compiled or not. Cut the path first, then use the profile so what remains runs at full speed from the first launch.
  • Why must the profile be regenerated for each release?
    It lists the code the startup path ran in the build it was captured from. Renamed, moved or new start-up code is missing from an old profile, so it runs uncompiled on first launches until the device optimises it later, quietly undoing the benefit. Generate it in the release pipeline from the journeys the launch budget measures.

  • A startup profile fixes a launch that waits on the network.
  • The first launch after an update is as fast as any other, so it needs no separate segment.
  • A profile captured for an old release still covers the new release's start-up code.
  • A startup profile makes deferring SDK set-up unnecessary.