prodz18 / TiFlexiGrid

An Alloy Widget for creating grid layouts.
125 stars 36 forks source link

Preformance tips for large number of grids? #14

Open daveeel opened 10 years ago

daveeel commented 10 years ago

Hi, I am trying to use the widget for a large number of grids.

Tested with about 150 grids with a local image (80x80) and a label for grid item. The rendering speed on device rotation almost freezes my "old" iPhone 4. On iPad Air, the speed is barely acceptable. I see 3-4 grids drawn per second. I tried your original sample by duplicating the sample data. It seems that image size and whether it's local or remote do not matter.

Ideally I wish to use the widget for about 200-300 grids. So my question is: is there any way to increase the performance?

prodz18 commented 10 years ago

Hi. I think that right now the best solution is to show a limit of item (like 20-30) and add more items when the user scrolls to the end or adding a button at the end to load more items to the grid. The same thing could happen if you add like 300 rows to a table view or list view; that's why lazy loading or adding a add-more button is used for. I'll think of a better solution for this kind of situation.

daveeel commented 10 years ago

Thanks for the prompt reply. So doesn't the current implementation already supports lazy adding?

prodz18 commented 10 years ago

Right now it doesn't have it right "out of the box", but it could be achieved using the addGridItems() function of the widget. You could have the array of 300+ items and add only the first 30 items. Then, you can add an "add-more button" at the end to push 30 more items to the grid or by using the scroll event and detect when the user is near the end of the scroll view.

daveeel commented 10 years ago

Thanks. Shall try that. And hopefully the widget could add 'lazy adding' feature in future releases :)

lithiumlab commented 7 years ago

hi Pablo; do you have an example somewhere how to detect scroll event is near the end? i can't find one. thanks in advance.