I'm looking at the new `compose stability analyze ...
# compose
u
I'm looking at the new
compose stability analyze IDE plugin
(https://github.com/skydoves/compose-stability-analyzer/) and I have a question about this callsite. on one hand it says
ActiveTariff
and
List<Dashboard.DataUsageTile>
which are both sealed classes - they cannot be determined at compile time - but CAN at runtime, right? (also, why? all the children are right there in the same module & they're data classes, I figured the compile time analysis works on AST or something like that; not speculative execution) on the other hand the whole
RegularBody
is not skippable due to the 2 being unstable - why? I though they can be be stable but deferred to runtime, no? and if proven such, then the
RegularBody
should be skippable, no?
s
Yeah, the plugin is just wrong here
☝️ 2
☝🏾 1
u
How so? I thought it only surfaces the compose compiler outputs
or is that just bad wording?
s
No, it copied the logic for analysis. It is /quite/ hard to use compiler outputs for this kind of real-time analysis
1
u
dammit thats even worse than not knowing :d
s
The
runtime
stability means that these classes are from a different module, and it is stable, but we cannot prove that it won't be unstable as the module evolves (e.g. if it is a library that you upgrade). The runtime stable values just check a stable flag on the class instead of explicitly being resolved to stable. If you are using version of Kotlin that is new enough (after 2.0, I believe), you have strong skipping enabled, and then your function is /always/ skippable. Compose just compares unstable values by reference instead of equals in that case, which is fine in 90% of cases.
u
> The
runtime
stability means that these classes are from a different module, and it is stable, but we cannot prove that it won't be unstable does that mean even a data class, but from a different module will only be compared by
===
?
or a sealed class from the same module, also only ref check? (even if the concrete child type is a data class?) (yes im on new stuff so strong skipping is on)
k
I'd recommend using the official compose compiler debug report https://developer.android.com/develop/ui/compose/performance/stability/diagnose
1