You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[android] avoid View.Context during ContextView scrolling (#8243)
Context: #8012
Context: https://github.com/Kalyxt/Test_CollectionView
We had some reports of poor `CollectionView` performance while
scrolling on an older Android device.
Reviewing `dotnet trace` output, I did find some issues similar to #8001:
317.42ms (1.1%) mono.android!Android.Views.View.get_Context()
1% of the time is spent in repeated calls to `View.Context` inside the
`ItemContentView` class. Making a new overload for
`ContextExtensions.FromPixel()`, I was able to remove all of these
calls.
This results in only a couple `View.Context` calls on startup now,
much better:
1.30ms (0.01%) mono.android!Android.Views.View.get_Context()
Using the "janky frames" metric from the latest profiler in Android
Studio Dolphin:
https://developer.android.com/studio/profile/jank-detection
With my slowest Android 12+ device, a Pixel 4a, I could actually see a
few "janky frames" while scrolling the sample.
With these changes in place, I only see 1 "janky frame" now.
I also compared the before and after with the visual GPU profiler:
https://developer.android.com/topic/performance/rendering/inspect-gpu-rendering
It appears at a glance that these changes are better.
I am unsure at what point the performance will be good enough to close#8012, but this helps!
0 commit comments