Fast by Default: Startup Time, Jank, Baseline Profiles, Memory Leaks and Battery: Measuring and Fixing Android App Performance with Macrobenchmark and Perfetto
Fast by Default is a practical guide to the Android performance problems users feel without being able to name them: a launch that hangs on a blank screen, a list that stutters under the thumb, a heap that keeps growing, a phone that is warm in the pocket and half empty by lunch. It starts from the numbers Google Play itself watches in Android vitals (slow cold, warm and hot starts at 5, 2 and 1 seconds, slow rendering, frozen frames, excessive wakeups, the core crash, ANR and partial wake lock thresholds) and one rule that runs through every chapter: measure first, on a release build, then fix the thing the measurement points at. You learn the tools (Android Studio Profilers, Perfetto, Layout Inspector, Macrobenchmark and Microbenchmark), measure startup with StartupTimingMetric and fix it with lazy initialization, App Startup and reportFullyDrawn, generate and verify a Baseline Profile and a Startup Profile, find jank in Jetpack Compose with FrameTimingMetric, JankStats and the Compose compiler reports, hunt memory leaks with LeakCanary and heap dumps, keep background work off the battery with WorkManager instead of wake locks, cut network, disk and app-size costs with OkHttp caching, StrictMode and R8, and put benchmarks into CI with regression thresholds. Everything is applied to a small notes app, Field Notes, as a repeatable performance pass. Every library version and every Android vitals threshold was checked against the official Android Developers pages, Play Console Help and the projects' own changelogs in October 2026. No invented benchmark numbers: the book teaches the method, and your numbers are your own.
What you get
- Why debug builds lie, and how to measure what users actually get: release builds, R8, not debuggable, the profileable manifest element
- The tools and what each is for: Android Studio Profilers, Perfetto and the system trace, Layout Inspector recomposition counts, Macrobenchmark, Microbenchmark and the Gradle plugins, with a one-screen tour of a Perfetto trace
- Startup: cold, warm and hot starts, TTID vs TTFD, Application.onCreate on a diet, App Startup initializers, the SplashScreen API, reportFullyDrawn, and measuring it all with StartupTimingMetric
- Baseline Profiles and Startup Profiles: how ART runs your code, the androidx.baselineprofile plugin, a BaselineProfileRule generator, a better DEX layout, and proving on a device that the profile is applied
- Jank in Compose: frame budgets, FrameTimingMetric and JankStats, stability and strong skipping, compiler reports, derivedStateOf, lazy list keys, deferred reads, images with Coil 3, and modifier order
- Memory: LeakCanary, heap dumps in the Memory Profiler, the common leaks and their fixes, bitmap sizing, onTrimMemory, and a note on 16 KB pages
- Battery and background work: Doze and App Standby buckets, partial wake locks, WorkManager vs foreground services, wakeups and alarms, network batching, location strategies, and measuring battery use
- Network and disk I/O: StrictMode, OkHttp caching, asking for less, efficient Room queries, serialization costs, and app size with App Bundles, R8 and resource shrinking
- Performance in CI: a benchmark module layout, dry runs on every pull request, steadier results, benchmark JSON as a chart, regression thresholds, Baseline Profiles regenerated on release, and Android vitals after launch
75 pages, 23 diagrams plus a chapter-opener graphic for every chapter, a performance checklist and a cheat sheet. PDF and EPUB. Android the Right Way, Book 7.
Not sure yet? Read the free sample first: the cover, the full table of contents and all of Chapter 3, "Baseline Profiles and Startup Profiles" (how ART runs your code and why new installs start slow, what a profile file looks like, setting up the generator module with the androidx.baselineprofile plugin, writing a BaselineProfileRule generator for the app's critical journeys, Startup Profiles for a better DEX layout, proving the profile is applied with adb and ProfileVerifier, and the Play side), at https://payhip.com/b/rsUtW
Also in a bundle: Everything Bundle: every ebook in the store, $89 ยท Android Bundle, $49.