GIGAMOLE / ComposeShadowsPlus

ComposeShadowsPlus: Elevate your Android Compose UI with stunning custom shadows

Home Page:https://www.linkedin.com/in/gigamole/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Performance slow down

Divasik opened this issue · comments

Hi, Basil
Would you recommend something to boost rendering composables with these shadow effects some way?
10-12 simple composables in lazy column render ~50-70 ms,
compared to multiple drawRoundRect() for ex. they render ~7-8ms.
(CPU profiling of release build on Samsung A8+, RenderThread, RSBlur type)

HorizontalPager with several lists looks laggy during scroll animation.
Thanks!

Hi, thanks for commenting.

As for the problem you have, yes, that is the predicted outcome, since RSBlurShadow is drawing a shadow using the bitmap draw and RenderScript init process, which makes such lags. It is more for the static content.

Try to use the SoftLayerShadow instead or Elevation.

Or, if you want to use RSBlurShadow, then you have to create the following: create the instance of RenderScript library one time, and if you have static item heights, then you can create one bitmap and reuse it in each item. If the item's heights are dynamic, then it will be not possible to achieve easily.