Android Shadow performance is poor #27156
Labels
area-drawing
Shapes, Borders, Shadows, Graphics, BoxView, custom drawing
platform/android 🤖
t/bug
Something isn't working
t/perf
The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)
Milestone
Description
The speedscope
Apparently

DrawShadow
has an absurd impact on the performance.Here's a speedscope from our app sorted by self time descending, also look at total time %!!!
Why is this happening?
This is what happened while
draw
ing theAndroid.Views.View
every time you enable aShadow
somewhere:extractAlpha
)draw
You can imagine the kind of slow down this generates when a shadow is applied to a node which has a lot of descendants.
The cache at field level is really a poor one, in the sense that invalidation happens every time something changes on the descendants via
requestLayout
.Steps to Reproduce
Use a real-world application containing shadows, profile it, and see how
drawShadows
consumes a lot of CPU.Link to public reproduction project repository
No response
Version with bug
9.0.30 SR3
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No workaround available besides not using shadows.
The text was updated successfully, but these errors were encountered: