-
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
[android] MauiTextView doesn't need ViewAttachedToWindow #14833
Merged
PureWeen
merged 1 commit into
dotnet:main
from
jonathanpeppers:MauiTextView.ViewAttachedToWindow
Apr 29, 2023
Merged
[android] MauiTextView doesn't need ViewAttachedToWindow #14833
PureWeen
merged 1 commit into
dotnet:main
from
jonathanpeppers:MauiTextView.ViewAttachedToWindow
Apr 29, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context: dotnet#12130 Context: https://github.com/angelru/CvSlowJittering Profiling a customer sample, I noticed that ~2.4% of of the time was spent subscribing to `ViewAttachedToWindow`: 278.55ms (2.4%) mono.android!Android.Views.View.add_ViewAttachedToWindow(System.EventHandler`1<Android.Views.View/ViewAttachedToWindowEv It appeared that for every `Label` on Android, we setup this event. Additionally, Java would have to call into C# when the event fires: 30.55ms (0.26%) mono.android!Android.Views.View.IOnAttachStateChangeListenerInvoker.n_OnViewAttachedToWindow_Landroid_view_View__mm_wra However, we don't actually *do* anything in the event (added in b6c3b53), so we should be able to just delete it? this.ViewAttachedToWindow += MauiTextView_ViewAttachedToWindow; //... private void MauiTextView_ViewAttachedToWindow(object? sender, ViewAttachedToWindowEventArgs e) { } Doing this, dropped the call to ~0.02%: 2.76ms (0.02%) mono.android!Android.Views.View.add_ViewAttachedToWindow(System.EventHandler`1<Android.Views.View/ViewAttachedToWindowEv And the above `IOnAttachStateChangeListenerInvoker` call is gone completely. This should improve the performance of every `Label` on Android.
ghost
added
the
legacy-area-controls
Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor
label
Apr 28, 2023
jsuarezruiz
approved these changes
Apr 28, 2023
mattleibow
approved these changes
Apr 29, 2023
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.
🙀
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Eilon
added
t/perf
The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)
and removed
legacy-area-controls
Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor
legacy-area-perf
Startup / Runtime performance
labels
May 10, 2024
samhouts
added
the
fixed-in-8.0.0-preview.4.8333
Look for this fix in 8.0.0-preview.4.8333!
label
Aug 2, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area-controls-label
Label, Span
fixed-in-8.0.0-preview.4.8333
Look for this fix in 8.0.0-preview.4.8333!
platform/android 🤖
t/perf
The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: #12130
Context: https://github.com/angelru/CvSlowJittering
Profiling a customer sample, I noticed that ~2.4% of of the time was spent subscribing to
ViewAttachedToWindow
:It appeared that for every
Label
on Android, we setup this event. Additionally, Java would have to call into C# when the event fires:However, we don't actually do anything in the event (added in b6c3b53), so we should be able to just delete it?
Doing this, dropped the call to ~0.02%:
And the above
IOnAttachStateChangeListenerInvoker
call is gone completely.This should improve the performance of every
Label
on Android.