-
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
Measure invalidation performance and fixes (batching version) #24823
Measure invalidation performance and fixes (batching version) #24823
Conversation
frame = control.Frame; | ||
desiredSize = control.DesiredSize; | ||
Assert.Equal(5, frame.X, 0.5d); | ||
Assert.Equal(60, frame.Width, 0.5d); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was failing on ListView
and TableView
due to the fact they were not propagating SetNeedsLayout
to the parent.
Thank you so much for your work, can't wait to try it out! Do you think or have you tested if it will also affect performance of rendering pages when navigating/performing first render? Currently navigation can be a lot slower than Xamarin in certain cases, sometimes even with static pages without binding and collections. |
@OvrBtn it improves that a bit if you're using |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
@albyrock87 great work! What about android, which seems to be the slowest platform overall so far in .net maui, have you seen even bigger improvements? |
@bcaceiro I'm not sure how, but in this |
namespace Microsoft.Maui.Controls.Internals; | ||
|
||
[Flags] | ||
internal enum InvalidationTriggerFlags : ushort |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InvalidationTrigger
is a public API but at the same time it says
For internal use by platform renderers.
So I wonder if I could simply change that to:
[Flags]
public enum InvalidationTrigger : ushort
{
None = 0,
BatchingBindingContext = 1 << 0,
// leaving empty space here in case we want to add other types of batching
NotifyOnChildMeasureInvalidated = 1 << 4,
HorizontalOptionsChanged = 1 << 5,
VerticalOptionsChanged = 1 << 6,
MarginChanged = 1 << 7,
SizeRequestChanged = 1 << 8,
MeasureChanged = 1 << 9,
RendererReady = 1 << 10,
Undefined = 1 << 11,
}
bef003d
to
4429238
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
|
/rebase |
4429238
to
c0057a0
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
- Do not bubble up `MeasureInvalidated` on pages - Invoke `MeasureInvalidated` just once when `BindingContext` is changing - Do not synchronously measure/arrange children on legacy layout upon child measure invalidated: simply wait for the next native layout pass
… switch branches
…parent correctly
…e to invalidate parent chain through the platform view on `ScrollView` (iOS)
c0057a0
to
4c07e48
Compare
Closing in favor of #25664 |
Description of Change
This is #24532 plus batching of measure invalidation.
I executed a speedscope on davidortinau/AllTheLists
LearningPage
using the latest nightly8.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:
BindingContext
on attached nodes by batching layout invalidation during binding context change & propagationBindingContext
changes, from the leaf to the rootHandler = null
)SetNeedsLayout
propagation issues and cleans up detection of autoSetNeedsLayout
parent propagation withIPropagatesSetNeedsLayout
internal interfaceWinUI 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.
before.mp4
After
PR
You can notice there hiccups are basically gone while scrolling, even if in this case I had a lot more nested children.
after.mp4
Issues Fixed
Fixes #24551