-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid duplicate measurements for children #46
Labels
Comments
Closed
Flexbox nested flexbox will cause performance degradation,too much measure |
Do you have any updates on this issue? |
thagikura
added a commit
that referenced
this issue
Oct 24, 2019
This PR prevents the number of measure calls for the children of the Flexbox. If any items in a FlexLine don't have the flexGrow or flexShrink attributes set, the children in the FlexLine don't have to be measured in the FlexboxHelper#determineMainSize method. Similarly, if the AlignItems attribute for the Flexbox is not equal to AlignItems.STRETCH nor any items in a FlexLine don't have the AlignSelf.STRETCH attributes, the items in the FlexLine don't have to be measured in the FlexboxHelpers#stretchViews method. Also this PR changes the default values of FlexboxLayout as follows: - mAlignItems: STRETCH -> FLEX_START - mAlignContent: STRETCH -> FLEX_START
thagikura
added a commit
that referenced
this issue
Oct 24, 2019
This PR prevents the number of measure calls for the children of the Flexbox. If any items in a FlexLine don't have the flexGrow or flexShrink attributes set, the children in the FlexLine don't have to be measured in the FlexboxHelper#determineMainSize method. Similarly, if the AlignItems attribute for the Flexbox is not equal to AlignItems.STRETCH nor any items in a FlexLine don't have the AlignSelf.STRETCH attributes, the items in the FlexLine don't have to be measured in the FlexboxHelpers#stretchViews method. Also this PR changes the default values of FlexboxLayout as follows: - mAlignItems: STRETCH -> FLEX_START - mAlignContent: STRETCH -> FLEX_START
I think this can be now closed. #514 should remove the unnecessary measure calls. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the onMeasure method, child.measure may be called more than once (e.g. Called first in the first loop to determine the number of flex lines, then called later to be expanded/shrank based on flexGrow/flexShrink attributes also maybe called to be stretched based on alignItems/alignSelf attributes).
This may cause performance issue especially the child is a nested ViewGroup.
It will be efficient to defer the child.measure as much as possible to reduce the number of measurements of the same child.
The text was updated successfully, but these errors were encountered: