table icon indicating copy to clipboard operation
table copied to clipboard

react-table with 75k+ rows is very slow and CPU-expensive

Open Omortis opened this issue 8 years ago • 2 comments

What version of React-Table are you using?

[email protected] [email protected]

What bug are you experiencing, or what feature are you proposing?

I have loaded a simple react-table component with 75k lines (in 6 columns) as per the "simple table" example at https://react-table.js.org/#/story/simple-table

The data source is being loaded into a Redux store and is fully loaded before the table component renders. Once loaded, the react-table is sluggish - if I click "next", I see the next page of data, but have to wait 7-10 seconds while the CPU churns before I can click "next" or "previous" again.

I do not (and will not) require any type of sorting for this data set but do plan to use the filtering functions of react-table. The component is not crashing in any way and seems to work well - is there anything I can do to speed it up and stop it from hogging the CPU? Is some background sorting operation eating up cycles or something? Suggestions welcome!

Note that your "100k" example at https://react-table.js.org/#/story/100k-rows-w-pivoting-sub-components displays a "RangeError" in Chrome....

Use https://codesandbox.io/s/X6npLXPRW (by clicking the "Fork" button) to reproduce the issue.

I cannot share the data online, and this much data would be impractical anyway...

Thanks in advance for any suggestions! Should I take this to stackoverflow? I see that there is a react-table tag.

John

Edit: aaaaand now an hour or so later (and a few npm restarts later) it seems to be working fine, which kinda makes me nervous.... Any idea what could have bogged it down?

Omortis avatar Dec 22 '17 15:12 Omortis

Fistly - the error in the 100K example is related to a change on codesandbox.io. if you change the makeData prop to 25000 it will work (it's something they have done recently to avoid infinite loops). But, those 100K rows are also pivoted (so the top level is less than 100K rows - but the rendering does start to slow down if all the levels of the pivot are open on any one page and more rows are being rendered).

Secondly, ReactTable is VERY MUCH page based. Without seeing the code I would not know but if you are trying to render a LOT of rows in the page it will be slow (there is no optimisation around virtualising the rendering). If you are using the height property to add a scroll-bar then this might be a hint that you are expecting something from ReactTable that it is not really designed to do (i.e. that number of rows probably requires progressive/infinite rendering/scrolling).

So... What is your pageSize set to?

I can't begin to explain what would have bogged it down and now started working without playing around with the implementation (which I realise is tricky).

gary-menzel avatar Dec 22 '17 22:12 gary-menzel

The defaultPageSize is set to 10, and I have some simple filters in place and working. I'm not sure what was bogging it down but it seems to be on it's feet and working fine now. I won't get back to this code til likely 1/2 and will have more cycles to dig into it then. Thanks for getting back to me!

Will close it up for now!

John

Omortis avatar Dec 22 '17 22:12 Omortis