react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

Limit Yoga layout to relevant root on resize

Open rozele opened this issue 3 years ago • 0 comments

Description

Type of Change

Erase all that don't apply.

  • Perf (non-breaking change which improves performance)

Why

Recalculation of Yoga layout due to root view size change does not require that we re-run layout on all roots. It also does not require that we invoke UpdateLayout on any new nodes (as a resize operation is independent of a batch of UIManager operations).

What

This change limits the scope of Yoga calculation and application of Yoga results to XAML views to only the root view that changed size. This optimization primarily impacts apps with multiple windows, but can also benefit any React Native Windows app with multiple roots.

In a future PR, we could also track impacted roots in view manager operations by looking up the rootTag field on the ShadowNode, and only running Yoga layout on windows with actual updates in a given batch.

Testing

Ran RNTester, window resize still adapts correctly.

https://user-images.githubusercontent.com/1106239/190245420-555c1b14-471a-4866-b04d-cd0fc0aebcde.mp4

Microsoft Reviewers: Open in CodeFlow

rozele avatar Sep 14 '22 18:09 rozele