Skip to content

Compute isBaselineLayout once per container instead of once per flex line (#2090) - #60232

Merged
meta-codesync[bot] merged 1 commit into
react:mainfrom
cipolleschi:export-D131401933
Nov 23, 2026
Merged

meta-codesync[bot] merged 1 commit into
react:mainfrom
cipolleschi:export-D131401933

Conversation

@cipolleschi

@cipolleschi cipolleschi commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary:
isBaselineLayout walks every layout child of the container. justifyMainAxis
called it once per flex line, so a wrapping container with N children and
L lines did O(N * L) work. Compute it once before the line loop and reuse
it in justifyMainAxis and in multi-line content alignment.

Changelog:
[General][Fixed] - Fix quadratic layout time in wrapping flex containers with many lines

Reviewed By: javache

Differential Revision: D131401933

…line (react#2090)

Summary:
isBaselineLayout walks every layout child of the container. justifyMainAxis
called it once per flex line, so a wrapping container with N children and
L lines did O(N * L) work. Compute it once before the line loop and reuse
it in justifyMainAxis and in multi-line content alignment.

Reviewed By: javache

Differential Revision: D131401933
@meta-codesync

meta-codesync Bot commented Nov 23, 2026

Copy link
Copy Markdown

@cipolleschi has exported this pull request. If you are a Meta employee, you can view the originating Diff in D131401933.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 23, 2026

@javache javache left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

@meta-codesync
meta-codesync Bot merged commit ef01391 into react:main Nov 23, 2026
104 of 105 checks passed
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @cipolleschi in ef01391

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Nov 23, 2026
meta-codesync Bot pushed a commit to meta/litho that referenced this pull request Nov 23, 2026
…line (#2090)

Summary:
X-link: react/react-native#60232

isBaselineLayout walks every layout child of the container. justifyMainAxis
called it once per flex line, so a wrapping container with N children and
L lines did O(N * L) work. Compute it once before the line loop and reuse
it in justifyMainAxis and in multi-line content alignment.

Changelog:
[General][Fixed] - Fix quadratic layout time in wrapping flex containers with many lines

Reviewed By: javache

Differential Revision: D131401933

fbshipit-source-id: 5ace60d0fb1e36104da1527c684dfc0cc1828121
gabrieldonadel pushed a commit that referenced this pull request Nov 23, 2026
…line (#2090)

Summary:
isBaselineLayout walks every layout child of the container. justifyMainAxis
called it once per flex line, so a wrapping container with N children and
L lines did O(N * L) work. Compute it once before the line loop and reuse
it in justifyMainAxis and in multi-line content alignment.

Changelog:
[General][Fixed] - Fix quadratic layout time in wrapping flex containers with many lines

Reviewed By: javache

Differential Revision: D131401933

Pull Request resolved: #60232

(cherry picked from commit ef01391)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants