[Bug] Bad GPU performance in PlutoVisibilityLayout
MajedDH opened this issue · comments
I profiled the Grid using large number of cells on a wide screen (21:9) the raster part of the profile is taking too long (that's a desktop profile!, it's supposed to be blazing fast)
Here is an image of a couple of frames: as you can see it is taking 25ms on average:
but removing the RepaintBoundary
from PlutoVisibilityLayoutChild
makes it much better: ~10ms
Using repaint boundary makes layers or masks or something that when used a lot which makes the operation expensive on the raster thread:
after removing the repaint boundary:
I've tried to set the boundary at row level but it was worse than removing it at all.
Maybe it should be mentioned in the documentation that when implementing custom cells in the grid if the custom cell has a heavy price when painting it should be used with repaint boundary.
Flutter version
Flutter version is 3.0.0
PlutoGrid version
on the Develop branch ef8c727
OS
Windows 11
@MajedDH
Thanks for providing test information for profiling.
So, as per your comments, I'll remove the RepaintBoundary
and add the content for the RepaintBoundary
to the document in the custom cell.
And overall I'll keep reviewing and tweaking things about performance when rendering large amounts of cells.
Untitled.video.-.Clipchamp.mp4
The video tested when RepaintBoundary was applied and when not.
It is RepaintBoundary from the beginning to about 22 seconds.
22 seconds to the end is not a RepaintBoundary.
Raster Thread seems to perform slightly better when not RepaintBoundary .
RepaintBoundary: about 16ms
Not RepaintBoundary: about 12ms
The reason I added RepaintBoundary in the first place is to prevent unnecessary repaint because all cells become Repaint whenever horizontally scrolled.
From your tests and my tests, it seems that repainting brings better results for Raster Thread performance.
Conclusion: Remove RepaintBoundary as your comment, and add to docs to consider using RepaintBoundary optionally in case user set custom cell.
Updated to PlutoGrid version 5.0.4.
Should I do the change ? or you'll do it?