Group Group Group Group Group Group Group Group Group

Jetpack Compose Performance

Hi all,
I’m currently on the 8th chapter of this book and I had some questions about how performant Compose is. In the SaveNoteScreen, whenever the title or text or color of NoteModel is changed, we copy the previous instance with the updated values and tell the viewmodel to update it’s Livedata instance. When it does that, Compose recomposes the screen with the new NoteModel instance. My question is that isn’t this very wasteful in terms of CPU and memory usage? Isn’t a new copy of NoteModel being created every time we type a single character for title or text? For an app with a complex UI and a lot of data, wouldn’t it lead to OOM errors or frame drops since Compose has to recompose every time? Apologies if this is a silly question, I’m still getting used to the reactive way of making apps.

1 Like

When I read this book, I had the same question in my mind.
We have to recompose entire screen, because of small changes in textfield.
I was also wondering how performance will decrease if we will increase number of textfields or make this whole screen more complex (for example a long form with many text fields and other elements).

I am also a beginner in thinking in compose way ;]