The transformed code roughly becomes:
They are functions that emit UI structure.
[here] for a detailed breakdown of the Slot Table structure, advanced stability techniques, and compiler plugin mechanisms. jetpack compose internals pdf download new
fun Greeting(name: String, composer: Composer, changed: Int) composer.start(123) // Group ID for "Greeting" if (changed or 0b1 != 0) Text("Hello $name", composer) else composer.skipToGroupEnd()
In this section, we will dive into the internals of Jetpack Compose, exploring how it works under the hood. The transformed code roughly becomes: They are functions
To make intelligent decisions during recomposition, the Compose compiler classifies types as or Unstable .
In Compose, the UI is not a tree of objects. It is a . The Slot Table is not a single array
The Slot Table is not a single array but typically consists of two parallel arrays: one for group metadata and another for the slots storing actual data. It's optimized for fast linear access, much like a gap buffer, which makes insertions and deletions very efficient. The Composer writes changes to this Slot Table, and the runtime can then use it to decide exactly which parts of the UI need to be updated.
The compiler guarantees that if the object instance is the same, or if its properties change, the runtime will be notified (e.g., primitives, String , or classes where all properties are val and stable).
Compose runs your composable functions to build a tree structure representing your UI.