Skip to content

Measure startup, jank & leaks

olef v3.18.0View Markdown

Outcome: quantify startup latency, frame drops, unnecessary Compose recompositions, or retained memory objects before and after a code change—without dumping huge HPROF files.

perf frames and perf startup run from the host against any installed app. perf leaks and layout recompositions --why require a debuggable app (and supported Compose 1.13+ metadata for --why). Always compare numbers on the same device or emulator; an emulator number reflects that emulator, not a budget physical phone.

Measure cold startup and scroll jank on the Feed screen before and after my
change using Olef. Then navigate into Detail and back three times and run
`olef perf leaks` to check for retained Activities, Fragments, or ViewModels.

Mixing cold and warm launches makes fake regressions and fake speedups easy to invent. olef perf startup verifies the Android LaunchState for every iteration and captures reportFullyDrawn() when your app emits it:

Terminal window
olef perf startup --app com.example.app --mode cold --iterations 5
olef perf startup --app com.example.app --mode warm --iterations 5

Reset gfxinfo framestats, exercise the scrolling or animation interaction, then sample percentiles (p50, p90, p95, p99), janky-frame counts, and software-rendering attribution:

Terminal window
olef perf frames reset --app com.example.app
# Scroll or animate the screen under test
olef ui swipe-ext up --scale 0.7
olef perf frames sample --app com.example.app

3. Bounded JVMTI leak chains (no HPROF dump)

Section titled “3. Bounded JVMTI leak chains (no HPROF dump)”

After navigating through a screen and popping back (or rotating), scan for retained destroyed Activities, Fragments, detached Views, and cleared ViewModels:

Terminal window
olef perf leaks --app com.example.app

perf leaks runs a time- and pause-capped JVMTI heap walk inside the debuggable process and returns shortest GC-root retention paths directly as structured JSON.

Knowing a composable recomposed is half the answer; knowing what state read triggered it tells the agent what to fix:

Terminal window
olef --project-root . layout recompositions --app com.example.app --why
  • perf leaks is a bounded diagnostic walk designed to stay responsive; it surfaces common Android lifecycle leaks rather than acting as a full heap profiler.
  • Emulator frame timings are useful for relative before/after comparisons, not absolute production SLAs. For representative hardware measurements, run on a USB phone or lease a physical device via Cloud emulators & real phones.

See olef perf and olef layout for all flags and budget options.