material-table icon indicating copy to clipboard operation
material-table copied to clipboard

Extremly slow perfomance while expanding grouped field with many results.

Open NicoEspositoARG opened this issue 7 years ago • 11 comments

First of all... Thank you for this excellent component! i found it very useful!

Bug report: When expanding a grouped field, that contains many results, total rows count of the table only considers the first level of agrupation. So when you try to expand this first level, the totaly of the results are rendered at once. In my case I have "categories" containing over 5k rows each, so when i try to expand it, it takes more than 30 seconds to render the data.

I tried with 7000 rows of data, 4 columns, zero actions on each row, and defining grouping: true as the only Option for the MaterialTable Component. Im using built-in data handling, not the remote data functionality.

To Reproduce Steps to reproduce the behavior:

  1. Set: data={this.props.dataArray}, options={{ grouping:true }}
  2. Drag and drop column header in order to group by.
  3. Expand one of the grouped values.
  4. When there is a significant amount of results it takes to long to render the rows, doesn't responds normally (the cursor gets buggy and no response browser warning is showned).

Expected behavior It would be great to have the pagination on the amount of expanded rows, and not only on the first level of aggrupation.

Desktop (please complete the following information):

  • OS: Ubuntu 18.4
  • Browser [Chrome]
  • Version [75.0.3770 64bits]

Thx!

NicoEspositoARG avatar Jul 26 '19 21:07 NicoEspositoARG

@NicoEspositoARG I think that the root of the issues comes from our API. We are paying the cost of React abstraction. Basically, having an intermediary component for each table elements has a cost. Compare with 100 rows:

  • https://material-ui.com/performance/table-raw/ Capture d’écran 2019-08-13 à 10 58 21
  • https://material-ui.com/performance/table-component/ Capture d’écran 2019-08-13 à 10 58 27
  • https://material-ui.com/performance/table-mui/ Capture d’écran 2019-08-13 à 11 01 38

An alternative would be:

import React from 'react';
import { Table } from '@material-ui/core';

// ...

      <Table>
        <thead>
          <tr>
            <th>#</th>
            <th>First Name</th>
            <th>Last Name</th>
            <th>Username</th>
          </tr>
        </thead>
        <tbody>

but we would lose style capabilities at the cell level. Can React handle 28k cells in the first place? If not, then virtualization is our best option.

oliviertassinari avatar Aug 13 '19 09:08 oliviertassinari

Hi @oliviertassinari maybe I wasn't clear in my original post, but i think the issue here is that the pagination doesn't work over the amount of expanded rows, it only takes to account the first level of aggrupation.

For example in the screenshot below, notice that the pagination is based in 2 items (rows) corresponding to the results of the first level of grouping ("state"). The results shown when expanding one of this levels are not been counted to the pagination logic. Even the amount of rows rendered does not correspond to the limit established per page.

image

Without grouping the pagination works as expected:

image

NicoEspositoARG avatar Aug 14 '19 17:08 NicoEspositoARG

HI, I have the same problem!

gabrieldaghetti avatar Feb 13 '20 14:02 gabrieldaghetti

This is happening to me too, any workaround?

sanders-vag avatar Feb 25 '20 11:02 sanders-vag

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Jul 05 '20 20:07 stale[bot]

Any chance we can get an alternative to this issue? Thx

NicoEspositoARG avatar Jul 08 '20 13:07 NicoEspositoARG

+1

avizaviz avatar Aug 07 '20 08:08 avizaviz

Let's my previous post about virtualization (as a way of performance improvement) where I share some sample code: https://github.com/mbrn/material-table/issues/891#issuecomment-681986647

mackankowski avatar Aug 27 '20 14:08 mackankowski

+1

androidemil avatar Nov 23 '20 13:11 androidemil

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Feb 21 '21 14:02 stale[bot]

the issue is still there...

germiy avatar Sep 15 '23 17:09 germiy