Is there a performance penalty when we use `Modifi...
# compose
d
Is there a performance penalty when we use
Modifier.weight(1f)
instead of
Modifier.fillMaxSize()
when we want the component to take up as much space as is available (it is the only component of the parent)?
1
s
I don't know the specific perf between those specific APIs, but reading between the lines you might be alluding to the perf penalty for weights on LinearLayout. Compose layout never does re-layout to apply weights, so you don't have to worry about similar problems in the Compose system.
👍 1
❤️ 2
a
+1 to the above,
Modifier.weight
reorders the child element to be measured after any unweighted elements, it is not measured multiple times like LinearLayout can do.
weight instructs Row/Column to divide remaining space proportionally among weighted child elements after unweighted child elements have been measured. fillMaxSize modifies incoming constraints for a child to set min = max for both width and height.
d
I think I understand it better, thanks.