Performance Optimization with @Stable and @Immutable in Jetpack Compose

  Рет қаралды 25,185

Philipp Lackner

Philipp Lackner

Күн бұрын

Пікірлер: 46
@nguyenvietquang2065
@nguyenvietquang2065 11 ай бұрын
Some facts i learned about recomposition: - var is always considered Unstable. It is the same concept with Phillip's List example. - viewModel is always unstable. - lambda may be stable or not, based on every "global" object you use inside it, for example using viewModel or var (not mutable state) will cause the function unskipable. For details, lambdas are anonymous classes keeping 1) the lambda content itself and 2) every objects that lambda is using other than parameters itself holds P/s: Overusing @Stable and @Immutable will sometimes make funny moments when your UI seems to not update instead log say yes 😂
@kinggeorges625
@kinggeorges625 11 ай бұрын
Thanks for the video. Can't wait for another full project tutorial
@yuuzuX
@yuuzuX 11 ай бұрын
Thank you for helping us to boost up our app performance.
@shahriarzaman4715
@shahriarzaman4715 11 ай бұрын
Every youtuber: How to make a simple todo list app in jetpack compose Philipp: Hey guys! Let's learn some advance topic Me: Why philipp is not uploading new video!!
@NickPerozzi
@NickPerozzi 11 ай бұрын
Great video. Honestly seems a bit silly to have to wrap a list with a state class just to mark it as stable. Would be awesome if we can eventually just annotate single params like you did at 6:38. Will probably stick to the ImmutableList approach because of this (provided the list doesn't merge well into an existing state)
@unknownBoy85lover
@unknownBoy85lover 11 ай бұрын
It's great for me that I started compose thank you sir
@jimpauloovejera2599
@jimpauloovejera2599 8 ай бұрын
you marked the class as @Stable but it would have been better if you try to update the state to showcase its stability
@Nick-v8x
@Nick-v8x 11 ай бұрын
Maybe recomposition becomes because your `var selected` is out of Column?
@Rafaelrgm
@Rafaelrgm 11 ай бұрын
Great Video. I wanna take the chance to ask for a new tutorial of a chat app using ktor and websockets, since the last one was about 2 years ago and is mostly deprecated... In my case the initial project couldn't even be built.
@brightonshifu
@brightonshifu 10 ай бұрын
This would be awesome.
@zafar_codes
@zafar_codes 11 ай бұрын
Cool. Also would like to see your video about performance and how to profile app using android studio’s profiler.
@ankitverma3932
@ankitverma3932 11 ай бұрын
Really helpful video. Plz make a video on Defer state reads and state hoisting.
@RahulKumar-un6ur
@RahulKumar-un6ur 11 ай бұрын
Awesome...Philipp...😎😎
@jms7634
@jms7634 10 ай бұрын
My problem with programming is it takes me like a hundred lines of code before i know when to use such annotation or any other concept. Optimization is such a headache but is a very crucial part when coding
@GeorgeC-ur9yw
@GeorgeC-ur9yw 4 ай бұрын
how do you notify compose compiler that @Stable object has changed? or how do you pass a new instance of @Imutable anotated class?
@mortezamgh1347
@mortezamgh1347 6 ай бұрын
Thanks, that was very helpful
@keepgoingman5829
@keepgoingman5829 10 ай бұрын
How about the code below? Does it can be a problem too? @Immutable data class User( val name: String, val age: Int ) { var address: String = "" } you can see the 'address' with Var in the body of the data class. Does it could be a bad performance?
@hoanghai5572
@hoanghai5572 11 ай бұрын
Seem like you change list to immutableList, if my list is still mutable, there is no way to prevent ContactList re-composed right ?
@solomonenakele7219
@solomonenakele7219 11 ай бұрын
Please why is Horizontal pager lagging so much, even after optimising recompositions.
@venkatesh4307
@venkatesh4307 11 ай бұрын
Great explanation
@nayabsarfraz586
@nayabsarfraz586 11 ай бұрын
This is so helpful 👏
@owenthompson8397
@owenthompson8397 9 ай бұрын
If you annotate a class as @Immutable which implies that the data class can never change, but it does and creates a new instance, wouldn't that have an impact on assigning more memory to accommodate the new instance.and also invoke recoposition?
@loafic
@loafic 5 ай бұрын
it's just a shallow copy, reorganizing the external Compose components, and most of the internal components will be skipped
@517Amit
@517Amit 11 ай бұрын
Don't know why >my layout inspector can't detect any component tree. I tried almost all the solutions from stack and from internet. But seems like on of them works. hedgehog
@dmytroberezhnyi717
@dmytroberezhnyi717 11 ай бұрын
There is more info about @Stable when we have custom modifiers
@mustafaammar551
@mustafaammar551 11 ай бұрын
thank you bro
@redaelmadini
@redaelmadini 11 ай бұрын
Very very good 👍 🎉
@jasv49
@jasv49 11 ай бұрын
How does this apply if we use ViewModels for UI state management?
@mieszkokozma4239
@mieszkokozma4239 11 ай бұрын
Exactly the same. It's all about the class you use as a state aka model for the functions marked @Composable
@imamyusupbachtiar5461
@imamyusupbachtiar5461 11 ай бұрын
Sir, is your online course lifetime if i buy it ? i still consider it to buy
@PhilippLackner
@PhilippLackner 11 ай бұрын
yes :)
@LightDante
@LightDante 10 күн бұрын
Why var is allowed in an @Immutable object?
@PhilippLackner
@PhilippLackner 10 күн бұрын
@@LightDante the annotation is just a promise that you fulfill the requirements, but there won't be any checks whether that's the case
@ahmedgames9335
@ahmedgames9335 3 ай бұрын
I coming from flutter 😂😂 and I was think that jetpack compose does not have the same way
@icodethis
@icodethis 11 ай бұрын
goat
@esneider
@esneider 11 ай бұрын
soy tu fanboy
@arozendojr
@arozendojr 11 ай бұрын
Suggestion, webview with kmp compose, as large companies use it, reason for use, code push on the website that the webview accesses, feature delivered faster, Cloud scalability, micro frontEnd, micro service in the cloud
@cursedfunction
@cursedfunction 11 ай бұрын
Please don’t do this. Use the right tool for the job. WebViews are not the do-it-all tool that some folks try to make them out to be.
@arozendojr
@arozendojr 11 ай бұрын
@@cursedfunction Market needs, code push, kotlin or swift do not have code push, the market finds webview solutions. Nowadays large companies use webview, for native code @JavascriptInterface, in the end they are creating a meta browser
@cularu1
@cularu1 6 ай бұрын
It's horrible.
@cularu1
@cularu1 6 ай бұрын
It's only good to update the "app" faster. It's basically a webpage not an app.
@razz3721
@razz3721 8 күн бұрын
I hate webview bad performance
@khanra17
@khanra17 8 ай бұрын
Jetpack Compose is terrible! They had a chance to switch to a modern paradigm and they made dog poop. Everything is hacky and complex.
MVVM vs. MVI - Understand the Difference Once and for All
18:40
Philipp Lackner
Рет қаралды 50 М.
ТЮРЕМЩИК В БОКСЕ! #shorts
00:58
HARD_MMA
Рет қаралды 2,6 МЛН
Симбу закрыли дома?! 🔒 #симба #симбочка #арти
00:41
Симбочка Пимпочка
Рет қаралды 4,7 МЛН
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 3,8 МЛН
derivedStateOf VS. remember(key) - THIS is Really the Difference 🤯
14:46
The Ultimate Gradle Kotlin Beginner's Crash Course For 2025
42:17
Philipp Lackner
Рет қаралды 3,8 М.
CppCon 2014: Mike Acton "Data-Oriented Design and C++"
1:27:46
Дмитрий Григорьев - Positional memoization. Как работает одна из главных концепций Jetpack Compose
53:34
Mobius — конференция по мобильной разработке
Рет қаралды 6 М.
Full guide to Jetpack Compose Side Effects
25:44
Land of coding
Рет қаралды 2,6 М.
Every Kind of Class in Kotlin
10:44
Dave Leeds
Рет қаралды 14 М.
Full Guide to Jetpack Compose Effect Handlers
24:56
Philipp Lackner
Рет қаралды 97 М.