md-data-table icon indicating copy to clipboard operation
md-data-table copied to clipboard

pageSelector causes long digest cycle for large datasets

Open scancmdr opened this issue 10 years ago • 6 comments

I have a large (server side) dataset on the order of 33,000 rows in my database. My DataService uses $http to query for slices of this dataset, usually 5 rows at a time.

When I enable the md-page-select attribute on the md-table-pagination element the initial digest cycle takes over 10 seconds to run on my workstation.

My pagination element looks like this: <md-table-pagination md-limit="vm.query.limit" md-total="{{vm.data.count}}" md-page-select="true" md-page="vm.query.page" md-on-paginate="vm.onPaginate" ></md-table-pagination>

I am able to reproduce this long digest cycle with this codepen: http://codepen.io/scancmdr/pen/KzmMpd

Note that I'm artificially setting the dessert count to a very large number, the larger you set it the longer the digest takes. Try setting the dessert count to 30,000, then 50,000 and 100,000 which causes my browser to freeze up. I can replicate this across Firefox and Chrome.

I wonder if there is a calculation that is being done that can be improved. This issue makes this data table component less useful for large server-side datasets.

scancmdr avatar Mar 23 '16 00:03 scancmdr

+1 Same problem. About 100.000 rows. When component binding md-total="{{count}}" browser goes to knockdown. And still thinking long time. The more the number, the longer busy component. The sensation that is transferred large amounts of data. Instead, a simple drawing. Try on IE11.

sergeos avatar Mar 23 '16 12:03 sergeos

Hi guys. Problem in md-select component (select page number) with large list. In my case I set md-total field to 100k number and in the background md-select rendering md-option elements (~6k in my case) that's why it's so long is performed. I think need to use more primitive component for select or make virtualization for options list.

deniskozlov avatar Mar 23 '16 13:03 deniskozlov

Ok, if I understand correctly, then the issue is too many md-option elements. Which is calculated by:

# of md-option elements = md-total / md-limit

so that for my 33k elements and 5 row limit, I'm rendering 6600 md-option elements for the select page drop down. That would make sense given that with higher md-total numbers more md-option elements are rendered.

I would suggest rendering a subset of the 6600 md-option elements. The idea being with so many pages to select from you don't necessarily need a sequential list, just a sampling of the page numbers to get you in the vicinity of where you're looking to go. For example, you could generate md-options for only every 10th page, etc. Maybe even generate md-options proportionate to the page total.

For now, I think a "jump to" page input box would be suitable for me. I will no longer use the drop down.

scancmdr avatar Mar 23 '16 14:03 scancmdr

The md-select component is known to be the source of this issue. I believe I am going to allow the developer to specify a step as @scancmdr suggested. If you have thousands of records I would avoid using the page select for now.

daniel-nagy avatar Mar 23 '16 14:03 daniel-nagy

In additional you can implement list virtualization by extending md-select component. In this example list rendering 900k elements

deniskozlov avatar Mar 23 '16 16:03 deniskozlov

Hi all, I just released v0.10.0 with virtualization for the page dropdown.

daniel-nagy avatar Mar 27 '16 22:03 daniel-nagy