-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Skip useless handler mappings calls while connecting #27259
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
Skip useless handler mappings calls while connecting #27259
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
5573017 to
893e551
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
| internal static bool IsMappingProperties(this IElementHandler handler) => | ||
| (handler as IElementHandlerStateExhibitor)?.State.HasFlag(ElementHandlerState.MappingProperties) ?? false; |
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.
The method as-is is user-friendly. However, the result is perhaps unexpected when handler is not IElementHandlerStateExhibitor. In that case, I would expect to get null (and not false) as it would tell me "perhaps the handler is actually mapping properties but it does not provide the information". Though, I'm aware that that might lead to less friendly API.
Anyway, feel free to ignore if you feel like it does not add any value.
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 is only temporary for .NET9, and the ?. is there for type safety.
Hopefully these methods will be public and moved to IElementHandler in .NET10.
|
Is this already available in nightlies? |
|
Definitely it would be good to try it. Great to see attention to the performances as MAUI struggles a lot there. |
Try this out and let us know: 9.0.40-ci.main.25073.66 |
|
@albyrock87 just tried the latest nightly, everything seems smooth! ( only tested so far on Android) |
do you have a repro I can test against to compare before and after this PR? Or possibly a video of what you mean by "everything seems smooth"? |
|
@PureWeen not really, since my app is quite complex (ble, views, etc) I haven't still recorded a speedscope, so it is really just more a "feeling" than any measurable data. In debug mode, and release mode, it seems the loads are a bit faster in pages Appearing, not dramatically faster, but seems faster. Once I have opportunity I will try to record something though |
|
@bcaceiro if you record the speedscopes for comparison, you should check timings on |
|
Update: this is not available on nightlies. So I really didn' test this PR in my previous "feeling". |
|
@MartyIX If I remember correctly in case of this page most of the delay is thanks to If you want I can try to create some example based more around changes in this PR but from what I've seen you already have one.
|
893e551 to
21694d0
Compare
|
Azure Pipelines successfully started running 3 pipeline(s). |
69a569a to
f15369c
Compare
a65cfad to
e8ced3c
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
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.
| /// <param name="view">The associated <see cref="IView"/> instance.</param> | ||
| public static void MapFlowDirection(IViewHandler handler, IView view) | ||
| { | ||
| if (handler.IsConnectingHandler() && view.FlowDirection == FlowDirection.MatchParent) return; |
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 is preventing FlowDirection propagation to child view
Since now path wont make it to this
| updateValue = GetParentMatchingSemanticContentAttribute(view); |
Related failing test : EntryClearButtonWorks
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.
Thanks, apparently UIKit is the only one not having an automatic MatchParent behavior, so I'm gonna skip this check if it's IOS || MACCATALYST.
| return; | ||
| } | ||
| #else | ||
| if (handler.IsConnectingHandler() && double.IsNaN(view.MinimumWidth)) return; |
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.
@albyrock87 This should not be on Windows to fix the check box test.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
* Skip useless initial handler mappings calls * Apply suggestions from code review, fixes check on Maximum* * Windows: automation properties are extremely costly * Fix broken UI tests * Workaround Windows broken tests --------- Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
* Skip useless initial handler mappings calls * Apply suggestions from code review, fixes check on Maximum* * Windows: automation properties are extremely costly * Fix broken UI tests * Workaround Windows broken tests --------- Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
* Skip useless initial handler mappings calls * Apply suggestions from code review, fixes check on Maximum* * Windows: automation properties are extremely costly * Fix broken UI tests * Workaround Windows broken tests --------- Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
* Skip useless initial handler mappings calls * Apply suggestions from code review, fixes check on Maximum* * Windows: automation properties are extremely costly * Fix broken UI tests * Workaround Windows broken tests --------- Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
* Skip useless initial handler mappings calls * Apply suggestions from code review, fixes check on Maximum* * Windows: automation properties are extremely costly * Fix broken UI tests * Workaround Windows broken tests --------- Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
* Skip useless initial handler mappings calls * Apply suggestions from code review, fixes check on Maximum* * Windows: automation properties are extremely costly * Fix broken UI tests * Workaround Windows broken tests --------- Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
* Skip useless initial handler mappings calls * Apply suggestions from code review, fixes check on Maximum* * Windows: automation properties are extremely costly * Fix broken UI tests * Workaround Windows broken tests --------- Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
* Skip useless initial handler mappings calls * Apply suggestions from code review, fixes check on Maximum* * Windows: automation properties are extremely costly * Fix broken UI tests * Workaround Windows broken tests --------- Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
* Skip useless initial handler mappings calls * Apply suggestions from code review, fixes check on Maximum* * Windows: automation properties are extremely costly * Fix broken UI tests * Workaround Windows broken tests --------- Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
* Skip useless initial handler mappings calls * Apply suggestions from code review, fixes check on Maximum* * Windows: automation properties are extremely costly * Fix broken UI tests * Workaround Windows broken tests --------- Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>



Description of Change
This is an alternative initial version of #27042.
Everything has already been explained there.
Based on/includes #28077 PR
Credits to @MartyIX to have explored the effectiveness of skipping specific mappers.
Key differences from the other PR:
IElementandIElementHandlerto get the handler stateMappingFrametakes care of all the coordinates, even translations, while on other platforms the situation is different)Benchmark using Nalu Weather app
https://github.com/nalu-development/nalu/tree/main/Samples/Nalu.Maui.Weather
Click on the links in the table to download the speedscope.json file.
SetVirtualView(SR4)SetVirtualView(PR)Thanks to @MartyIX for collecting speedscopes on Windows!
Benchmark (from CI - on iOS UI tests)
Note: there is some variability in the benchmark caused by the runner itself, but looking at many recent PRs,
mainbranch never goes under 2600ms.mainbranch#27042 original PR
this

PRIssues Fixed
Fixes #17303