Performance Optimization with @Stable and @Immutable in Jetpack Compose

  Рет қаралды 26,343

Philipp Lackner

Philipp Lackner

Күн бұрын

Пікірлер: 46
@nguyenvietquang2065
@nguyenvietquang2065 Жыл бұрын
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 Жыл бұрын
Thanks for the video. Can't wait for another full project tutorial
@NickPerozzi
@NickPerozzi Жыл бұрын
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)
@yuuzuX
@yuuzuX Жыл бұрын
Thank you for helping us to boost up our app performance.
@shahriarzaman4715
@shahriarzaman4715 Жыл бұрын
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!!
@unknownBoy85lover
@unknownBoy85lover Жыл бұрын
It's great for me that I started compose thank you sir
@RahulKumar-un6ur
@RahulKumar-un6ur Жыл бұрын
Awesome...Philipp...😎😎
@mortezamgh1347
@mortezamgh1347 7 ай бұрын
Thanks, that was very helpful
@jimpauloovejera2599
@jimpauloovejera2599 10 ай бұрын
you marked the class as @Stable but it would have been better if you try to update the state to showcase its stability
@nayabsarfraz586
@nayabsarfraz586 Жыл бұрын
This is so helpful 👏
@venkatesh4307
@venkatesh4307 Жыл бұрын
Great explanation
@Nick-v8x
@Nick-v8x Жыл бұрын
Maybe recomposition becomes because your `var selected` is out of Column?
@Rafaelrgm
@Rafaelrgm Жыл бұрын
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 Жыл бұрын
This would be awesome.
@zafar_codes
@zafar_codes Жыл бұрын
Cool. Also would like to see your video about performance and how to profile app using android studio’s profiler.
@mustafaammar551
@mustafaammar551 Жыл бұрын
thank you bro
@ankitverma3932
@ankitverma3932 Жыл бұрын
Really helpful video. Plz make a video on Defer state reads and state hoisting.
@redaelmadini
@redaelmadini Жыл бұрын
Very very good 👍 🎉
@jms7634
@jms7634 Жыл бұрын
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
@dmytroberezhnyi717
@dmytroberezhnyi717 Жыл бұрын
There is more info about @Stable when we have custom modifiers
@GeorgeC-ur9yw
@GeorgeC-ur9yw 6 ай бұрын
how do you notify compose compiler that @Stable object has changed? or how do you pass a new instance of @Imutable anotated class?
@imamyusupbachtiar5461
@imamyusupbachtiar5461 Жыл бұрын
Sir, is your online course lifetime if i buy it ? i still consider it to buy
@PhilippLackner
@PhilippLackner Жыл бұрын
yes :)
@owenthompson8397
@owenthompson8397 11 ай бұрын
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 7 ай бұрын
it's just a shallow copy, reorganizing the external Compose components, and most of the internal components will be skipped
@solomonenakele7219
@solomonenakele7219 Жыл бұрын
Please why is Horizontal pager lagging so much, even after optimising recompositions.
@keepgoingman5829
@keepgoingman5829 Жыл бұрын
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 Жыл бұрын
Seem like you change list to immutableList, if my list is still mutable, there is no way to prevent ContactList re-composed right ?
@jasv49
@jasv49 Жыл бұрын
How does this apply if we use ViewModels for UI state management?
@mieszkokozma4239
@mieszkokozma4239 Жыл бұрын
Exactly the same. It's all about the class you use as a state aka model for the functions marked @Composable
@ahmedgames9335
@ahmedgames9335 5 ай бұрын
I coming from flutter 😂😂 and I was think that jetpack compose does not have the same way
@LightDante
@LightDante 2 ай бұрын
Why var is allowed in an @Immutable object?
@PhilippLackner
@PhilippLackner 2 ай бұрын
@@LightDante the annotation is just a promise that you fulfill the requirements, but there won't be any checks whether that's the case
@517Amit
@517Amit Жыл бұрын
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
@icodethis
@icodethis Жыл бұрын
goat
@khanra17
@khanra17 10 ай бұрын
Jetpack Compose is terrible! They had a chance to switch to a modern paradigm and they made dog poop. Everything is hacky and complex.
@esneider
@esneider Жыл бұрын
soy tu fanboy
@arozendojr
@arozendojr Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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 7 ай бұрын
It's horrible.
@cularu1
@cularu1 7 ай бұрын
It's only good to update the "app" faster. It's basically a webpage not an app.
@razz3721
@razz3721 2 ай бұрын
I hate webview bad performance
derivedStateOf VS. remember(key) - THIS is Really the Difference 🤯
14:46
She wanted to set me up #shorts by Tsuriki Show
0:56
Tsuriki Show
Рет қаралды 8 МЛН
🎈🎈🎈😲 #tiktok #shorts
0:28
Byungari 병아리언니
Рет қаралды 4,5 МЛН
진짜✅ 아님 가짜❌???
0:21
승비니 Seungbini
Рет қаралды 10 МЛН
Full Room Database Tutorial - Build Notes App With Room DB
56:48
Ahmed Guedmioui
Рет қаралды 27 М.
How do we implement nested scrolling in compose?
12:05
Tech Encoder
Рет қаралды 151
Full guide to Jetpack Compose Side Effects
25:44
Land of coding
Рет қаралды 2,9 М.
The Top 3 State Management Mistakes On Android
14:30
Philipp Lackner
Рет қаралды 26 М.
How To Learn A New Programming Language
6:24
ThePrimeagen
Рет қаралды 287 М.
Jetpack Compose: Debugging recomposition
7:29
Android Developers
Рет қаралды 32 М.
Advanced Kotlin: Mastering Delegation in Kotlin
18:54
kt whisperer
Рет қаралды 9 М.
She wanted to set me up #shorts by Tsuriki Show
0:56
Tsuriki Show
Рет қаралды 8 МЛН