Most resources teach you how to use Compose. Jetpack Compose Mechanisms explains why it behaves the way it does, traced line by line through the AOSP source, from @Composable transformations to the gap buffer that stores your composition, to the single pass pipeline that turns declarations into pixels. Rather than a dry tour of internal APIs, it pairs every mechanism with practical, production ready examples, so you internalize how Compose works instead of memorizing it. It is fully updated for Kotlin 2.4.0 and Compose Compiler 2.4.0.
Here is what almost no one tells you: the @Composable function you wrote is not the function that runs. By the time the compiler finishes, a second, hidden function has taken its place, with a $composer threaded through every call, a $changed bitmask deciding whether to skip, a slot table that remembers your state by position, and a LayoutNode tree measured in a single pass and recorded into hardware layers. You have felt this machinery every time a recomposition fired when you did not expect it, every time a list scrolled with jank you could not explain, every time a compiler report flagged a composable as not skippable and left you guessing why. This book is the manual for all of it.
You will learn why @Composable is not an annotation but a change to the function's type, how the compiler rewrites your code into something closer to a state machine, why mutableStateOf triggers recomposition while a plain var does not, how the snapshot system hands you lock free, multithreaded state with no locks, why a single unstable List field can quietly slow an entire screen, and how the layout system measures everything in one pass. The book follows Compose down through its three layers, the compiler, the runtime, and the UI, then back up into a practical performance playbook across four chapters, 63 deep dive topics, and 41 original diagrams, closing with a case study that takes a janky chat screen from 47 recompositions a second down to zero.
Just as importantly, this book is grounded in real production experience, not source reading alone. Every mechanism in these pages is something the author has used, debugged, and shipped while building Compose tooling such as Compose Stability Analyzer, Compose Stability Inference, Compose HotSwap, and Compose Performance Skills. By the last page, Compose stops being a set of APIs to memorize and rules to follow on faith. It becomes a system you can reason about from first principles, predict before you press Run, and debug straight from the source.
If you'd like to learn more about the book before diving in, such as who it's for, what it covers, and what it doesn't, you can read the full details on the official website.
This repository is the companion issue tracker for the book, not the book itself. The book lives on its official website, Gumroad, and Leanpub.
If you spot a typo, a snippet that does not compile, or a technical inaccuracy, please open an issue so it can be corrected in the next edition. Questions about a mechanism and suggestions for future topics are welcome here too. Every report helps keep the book accurate as Kotlin and Compose evolve.
- 2026.06.16 - Published the first edition π
Support it by joining stargazers for this repository. β
Also, follow me on GitHub for my next creations! π€©
Copyright (c) 2026 skydoves (Jaewoong Eum). All rights reserved.
"Jetpack Compose Mechanisms" (the "Book"), including its text, diagrams,
illustrations, cover art, and all other content, is the proprietary work of
the author and is protected by copyright law.
You may not copy, reproduce, distribute, republish, resell, or otherwise share
the Book or any portion of it, in any form or by any means, without the prior
written permission of the author. Purchasing the Book grants you a personal,
non-transferable license to read it for your own use; it does not transfer any
ownership or redistribution rights.
The source code samples printed in the Book are provided for educational
purposes. You are free to use, modify, and incorporate these code samples into
your own projects without restriction or attribution.
This repository serves only as a companion issue tracker for the Book. The Book
itself is distributed via its official website, Gumroad, and Leanpub.
THE BOOK AND ITS CONTENTS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM,
DAMAGES, OR OTHER LIABILITY ARISING FROM THE USE OF THE BOOK OR ITS CONTENTS.