maui
maui copied to clipboard
Measure invalidation performance and fixes (batching version)
Description of Change
This is #24532 plus batching of measure invalidation.
I executed a speedscope on davidortinau/AllTheLists LearningPage
using the latest nightly 8.0.99-ci.net8.24468.1
build.
What I noticed is that #23052 OnChildMeasureInvalidatedInternal
was showing up and taking 2% of total time (recursive calls).
What I've done:
- Highly increases general performance when changing
BindingContext
on attached nodes by batching layout invalidation during binding context change & propagation- This is covered by a new suite of unit tests
- This makes finally predictable the layout invalidation when
BindingContext
changes, from the leaf to the root
- Avoids triggering measure invalidated completely while building the MAUI tree in memory (
Handler = null
) - Fixes some iOS
SetNeedsLayout
propagation issues and cleans up detection of autoSetNeedsLayout
parent propagation withIPropagatesSetNeedsLayout
internal interface - Removes "out-of-layout-pass" measurements from legacy layouts making them fast as new layouts
WinUI Speedscope
Kindly provided by @MartyIX
Before main
1726728202.MAIN.speedscope.json
After PR
1726728309.PR.speedscope.json
Before main
1726728235.MAIN.speedscope.json
After PR
1726728360.PR.speedscope.json
Android Speedscope
Before main
android-before.speedscope.json
After PR
after-android.speedscope.json.zip
iOS Speedscope
Before main
before.speedscope.json.zip
After PR
after.speedscope.json.zip
Before main
You can notice there are some hiccups while scrolling.
https://github.com/user-attachments/assets/41a64507-a9af-4fa3-bd0a-c98b0bfaea3c
After PR
You can notice there hiccups are basically gone while scrolling, even if in this case I had a lot more nested children.
https://github.com/user-attachments/assets/178466de-83bf-40a6-8426-c0b1a90cac6f
Issues Fixed
Fixes #24551