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

eygraber

03/01/2023, 5:26 AM
Is it a bad idea to introduce tooling to fail CI builds if the compiler metrics shows an unstable class being used as an input to a composable function?
b

Ben Trengrove [G]

03/01/2023, 5:27 AM
You could do a warning, failing seems a bit strong to me. Unstable != Bad
e

eygraber

03/01/2023, 6:02 AM
In my use case unstable might be worse than it typically is. I
collectAsState
on a
Flow
at the top level of my features, and fan out the state to the specific composables that need it. That state is always marked as
Immutable
but if one of its values (or grandchild values, etc...) is unstable it can cause a whole subtree to not get skipped when it should have.
b

Ben Trengrove [G]

03/01/2023, 6:05 AM
Fair enough but just a warning is probably fine. There will be cases where trying to force everything to be skippable/stable will just add huge amounts of complexity to code for no real gain in performance and if you are failing a build for it, I don't think it makes sense
e

eygraber

03/01/2023, 6:38 AM
I'm hoping I can build an exclusion feature for that.
b

Ben Trengrove [G]

03/01/2023, 7:19 AM
A better solution would be writing performance benchmarks and failing a build when you regress performance. Admittedly that's probably a bit more effort to set up though
e

eygraber

03/01/2023, 7:23 AM
First I need unit tests 😬
s

Stylianos Gakis

03/01/2023, 9:11 AM
A better solution would be writing performance benchmarks and failing a build when you regress performance. Admittedly that’s probably a bit more effort to set up though
A precedent for something like this can be set by introducing this setup in NowInAndroid. Do you think there’d be room for something like that there?
b

Ben Trengrove [G]

03/01/2023, 9:15 AM
It is actively being investigated right now
s

Stylianos Gakis

03/01/2023, 9:18 AM
Awesome! Is this discussion taking place in a public setting? Is there an Issue inside NiA I can for example follow, or is it too early for that?
b

Ben Trengrove [G]

03/01/2023, 9:25 AM
I don't think there is a public issue currently, I'm not 100% across it though
2 Views