Optimize recompositions on focus change#1138
Conversation
|
Hi @damontecres I also see a way to improve recompositions of the background on the homepage. Let me know if you are interested in the performance work being submitted, I don't want to step on your toes if you have some work planned in that regard! |
Hi @rozPierog, thanks for the contribution! Optimizations & performance improvements are always welcome! My only ask would be to try to keep individual optimization PRs relatively small & focused. That way it is 1) easier to review and 2) easier to measure actual improvements. At a glance, this PR looks very focused and I appreciate that you included the recomposition results from the layout inspector. I'm looking forward to reviewing and testing this! |
damontecres
left a comment
There was a problem hiding this comment.
Thanks again for the contribution! There's definitely some performance improvements here.
I left a few suggestions & questions!
|
@damontecres thanks for the review. I've applied the suggestions, and cleaned up the changes a bit based on your comments |
|
@damontecres congrats on a big 0.6 release! I know that it's often hard to find the time, but I would appreciate your re-review after changes. |
Description
I've look at the app using Layout inspector to see if there are any recompositions that shouldn't be happening while navigating normally in the app. I've noticed two issues
Related issues
Performance on the home screen is lacking, especially on low end devices, while this isn't a full fix, it will improve the navigation, as the app will be making significantly less work.
Probably will fix #1043
Testing
Using Layout Inspector built-in recomposition counter and highlights it's easy to see components which recompose while they shouldn't. I've tested it on a 4K TV emulator on my M1 Macbook Pro
Screenshots
main:

my branch:

same navigation, on the same content. (down, right x4
AI or LLM usage
Gemini built in to Android Studio helped me identify non-stable parts of the code. It also helped me understand and implement fixes in the HomePage code.
I've took the time to check manually that it didn't alter any behavior, and verified the fixes using Layout Inspector and recomposition counter