Skip to content
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

MAUI - Breadcrumbs for Element/VisualElement add too much overhead in some cases #2919

Closed
Redth opened this issue Nov 28, 2023 · 3 comments · Fixed by #2900
Closed

MAUI - Breadcrumbs for Element/VisualElement add too much overhead in some cases #2919

Redth opened this issue Nov 28, 2023 · 3 comments · Fixed by #2900

Comments

@Redth
Copy link

Redth commented Nov 28, 2023

Problem Statement

While doing some performance analysis of a MAUI app I've noticed on Android (and I expect iOS is also impacted, though I haven't looked closely there yet) that there's a fair bit of time spent adding breadcrumbs from the MauiEventsBinder wiring up various events.

In this particular case it seems the BindElementEvents and/or the BindVisualElementEvents are where most of the overhead comes from.

I have a virtual list control which correctly updates recycled views within the visual tree, and this means binding context changes often as well as child add/removes often too for items in the list as you scroll. Given the scenario of a high performance scrolling list, I feel like breadcrumbs are not well suited to be added in these cases.

It would be great if there was a way to disable wiring up element/visual element events in some cases, or perhaps to limit the types of events that get bound in an app (eg: a setting to keep or not wire up categories individually - Application, Window, Page, Shell, Button events I'd like to keep, but Element, VisualElement, Reflected I'd prefer to disable entirely).

Solution Brainstorm

No response

@jamescrosswell
Copy link
Collaborator

Hey @Redth , thanks for the feedback. I think this should be addressed in:

@Redth
Copy link
Author

Redth commented Nov 28, 2023

@jamescrosswell thanks, this definitely will help! After the changes in that PR, I do think the BindElementEvents is still unnecessarily heavy and it would be great to be able to disable that category still too.

@Redth
Copy link
Author

Redth commented Nov 28, 2023

Also, looking at the code here, it really should be updated to unsubscribe from most of the events that get wired up. The Application level, and maybe even the Window level ones aren't as much of an issue but the rest are going to cause memory leaks in MAUI apps. This is something we are actively working on reducing in .NET 8 / .NET 9, it would be awesome if you could help minimize this in your code base too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants