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

Chris Johnson

08/24/2021, 6:34 PM
Hi everyone! I was looking around in the source code at ConstraintLayout and it's using
MultiMeasureLayout
which is Deprecated with the message:
Copy code
This API is unsafe for UI performance at scale - using it incorrectly will lead " +
    "to exponential performance issues. This API should be avoided whenever possible.
Even though it's annotated with Suppress("Deprecated") that's still worrisome. Could anyone shed some light on whether or not ConstraintLayout is indeed safe to use at scale in compose?
a

Adam Powell

08/24/2021, 6:42 PM
It can end up being more expensive than compose's layout system would prefer in some constraint configurations. If you're concerned, the best thing to do is profile your use case between ConstraintLayout and other layout implementations
👍 1
Often the performance concerns are mitigated since ConstraintLayout is often used in flatter/shallower layout hierarchies
c

Chris Johnson

08/25/2021, 5:28 PM
Thank you! I was wondering if in smaller use cases it was okay or if creating a custom layout would be better. Sounds like it it's okay to rely on it 🙂
5 Views