spierce7
09/22/2024, 4:47 PM@NonRestartableComposable
?
I watched a talk on Compose 2 months back, where the speaker was talking about under the hood of Compose. The speaker was very nervous, but clearly had a plethora of knowledge. I think he worked at Google? Anyways, I remember him distinctly mentioning that we should be using @NonRestartableComposable
in our Root screens, and it was a micro optimization we could take advantage of. I know it's probably not really necessary, but I wanted to watch again and refresh myself on it, but can't find the video.Zach Klippenstein (he/him) [MOD]
09/22/2024, 5:12 PMThis annotation can be applied to Composable functions in order to prevent code from being generated which allow this function's execution to be skipped or restarted. This may be desirable for small functions which just directly call another composable function and have very little machinery in them directly, and are unlikely to be invalidated themselves.
Zach Klippenstein (he/him) [MOD]
09/22/2024, 5:12 PMspierce7
09/22/2024, 5:14 PMZach Klippenstein (he/him) [MOD]
09/22/2024, 5:15 PMhfhbd
09/22/2024, 5:32 PMspierce7
09/22/2024, 5:32 PMhfhbd
09/22/2024, 5:37 PMZach Klippenstein (he/him) [MOD]
09/22/2024, 5:38 PMshikasd
09/22/2024, 6:17 PMsaket
10/01/2024, 3:59 PMI think the docs are pretty clear:i'd like to argue against this. i don't think the doc is clear enough, and i'm saying this someone who thinks he's quite proficient with compose. it took me a while to understand what the docs meant, especially these lines:
This may be desirable for small functions which just directly call another composable function and have very little machinery in them directly, and are unlikely to be invalidated themselvesit would have helped if the doc contained an example to clarify what the term "machinery" meant in this context