pluto_grid
pluto_grid copied to clipboard
[Discussion] Performance when using the grid with large data
In my example I used the grid with 150k rows x 15 columns= ~2.2 million cells. I think that's both memory and CPU intensive, the app froze for ~6-12 seconds for both creating the PlutoCell
and PlutoRow
and initializeRows
inside the grid. these tests are made on web platform as debug, (same tests on desktop/android platform is much faster, you can feel the lag but i think it is negligible).
The main two places for these hangs are:
-
initializeRows
at pluto_grid_state_manager.dart#L94 is doing alot of heavy work on the main thread. - there is a large collection of
PlutoCell
andPlutoRow
made by the consumer outside the grid
What if we changed the way the grid works? from giving all the data beforehand to using the builder. We can delegate the builder we're using inside ListView.builder
, and column filters to some methods and functions provided by the consumer.
I think it needs some testing before fully applying it , because it may increase the small scroll lag that already exists now when scrolling vertically in large distances and it may be hard to fix selection, scrolling, and related problems.
What do you think?
First of all, thank you very much for your interest and contribution.
I agree with your opinion.
In version 3.0.0-pre.x, it would be good to distribute the current 3 PRs and the issues mentioned. I will create a 3.0.0-pre.1 branch and merge those PRs. (After fixing some errors and fixing the test code)
As long as there are no problems with the existing operation, I will distribute all of your PRs.
Thanks again for your interest and contribution, if you wish I can register you as collaborators for this repository. Also, I am licensed for Jetbrains All products, if you would like this too, please let me know.
@MajedDH PlutoGrid 4.0.0 has been deployed.
Rendering speed is improved over the previous version. It is faster in Profile mode, and seems to be slower than before in Debug mode. This is confirmed to be due to the code for the Provider's profile.
In the previous version, when there are more than 30 columns, the frame dropped when moving cells with the keyboard. Also, UI freezes when setting a large number of rows when creating a grid. This is also an updated solution.
Below is an example link. Take a look and let me know if you have any comments. https://weblaze.dev/pluto_grid/build/web/#feature/add-rows-asynchronously
Note that, Some Providers are used for state management. Some of the problems in the link below have been improved, but still I have confirmed with DebugProfiler that frames are dropping due to removeListener . https://github.com/flutter/flutter/issues/71900
And, in the previous version, if there are many columns, the number of columns increases as Cells are built, which slows down the speed. I tried to use ListView.builder etc to solve this, but I thought it would be difficult with the structure now. After much deliberation, I checked whether the column is currently visible with the VisibilityDetector package and decided whether to build the Cell. I've noticed a lot of performance improvements in Flutter's profile mode. However, there is one more thing I would like to address. VisibilityDetector package can check the visible ratio based on the current screen area. I would like to expand the screen area so that the adjacent columns in advance are included in the visible area. I've looked at the source code, but I'm still not sure.
Still, there are more codes that lower frames. There was a long way to go. Still, you improved the speed of the Resize column and it helped me a lot. Thank you again.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.