https://kotlinlang.org logo
#compose
Title
# compose
h

harry248

08/08/2022, 9:29 AM
I am curious - are you doing optimizations like mentioned here: https://multithreaded.stitchfix.com/blog/2022/08/05/jetpack-compose-recomposition/? Especially unstable lambdas are something I've never thought about before.
👀 3
👌 1
s

Stylianos Gakis

08/08/2022, 9:51 AM
@shikasd also made a very interesting thread regarding this with a “unreasonable amount of lambda trivia” as he warned 😅 If you like this article you’ll probably be interested in this thread too. We also had a discussion regarding one of the tips which suggests to use reference lambdas on your non-stable types (like viewmodel in the example) as opposed to a normal lambda at the end of the thread mentioned above. With one question not yet answered, but hopefully someone else can chime in with an answer sometime 😄
h

harry248

08/08/2022, 11:12 AM
@Johnny @Artur Schwarz fyi
@Stylianos Gakis A good thread, thanks. I would actually be interested in what expectations the Compose team has here. Do they take it for granted that developers are aware of these things? Or do they assume that it is often implemented not optimally, but don't see a problem with that because the negative impact isn't big enough.
s

Stylianos Gakis

08/08/2022, 12:22 PM
I think the idea is that as long it's not a correctness bug then it's mostly okay, and this is not a correctness bug, just a potential perf one. Things will get more performant as time goes anyway. From that point it's a matter of using the app and measuring performance and only in the case where there's a real perf issue you can delve down to these details. That's what I've understood at least from all the discussions here and in general.
h

harry248

08/08/2022, 12:27 PM
I'm not very familiar with the debates on this topic. Are these things that are being worked on so that sooner or later you won't have to make these optimizations yourself?
s

Stylianos Gakis

08/08/2022, 12:33 PM
One example thread here https://twitter.com/objcode/status/1379954263837712388?s=20&t=uCK5p0UlnPWB2x60DrUCIQ . I doubt that these optimizations will become 100% redundant and that everything will just magically be generating the absolute most performant code every time. In the cases where one needs the performance I think that we’ll still need to take these extra steps to go with the “performant” approach.
2 Views