DataTables-Hide-Empty-Columns icon indicating copy to clipboard operation
DataTables-Hide-Empty-Columns copied to clipboard

performance issues on big tables

Open lapkritinis opened this issue 9 years ago • 6 comments

There is significant lag on a tables with 5000+ rows and 30 or so columns. So I propose couple of optimisations. First, break loop on first non empty column found as there is no point to check rest of columns as result is already predetermined: for (var i = info.start; i < info.end; i++)
 if (_isEmpty(data[i]))
 empty++
 else
 break;

Second, which brings most benefit - is to disable "redraw" upon each column setting visible or not: if (empty === (info.end - info.start)) { api.column(this.index()).visible(false, false) } else { api.column(this.index()).visible(true, false) }

after calling _checkPage() do api.draw();

lapkritinis avatar Apr 18 '16 13:04 lapkritinis

Thanks for the heads up, ill work on this asap and get it fixed.

I like you proposed solutions, I will test those out and implement them!

jhyland87 avatar Aug 08 '16 16:08 jhyland87

Any update yet?

Friends4U avatar Apr 13 '19 22:04 Friends4U

Hi . i have same problem. i have 900+ columns and 20+ rows but when i set table to hide empty columns it take long time ( for example it's take 6 second to hide ) please guide to reduce time .thanks

ekhtiari avatar Jul 06 '19 14:07 ekhtiari

I have implemented these changes long ago in my project and I don't have performance problems with thousands of rows

lapkritinis avatar Jul 09 '19 12:07 lapkritinis

lapkritinis solution is 100% working.

radinsky avatar Sep 15 '20 08:09 radinsky

First of all - a great extension, with great functions. Well programmed and commented!

I downloaded the latest release, which does have the suggestions from @lapkritinis already implemented (I guess). A search w.o. takes with 60k rows 1sec - with enabled plugin it takes up to 15sec.

Any further optimisations, suggestions? Thanks.

tefod-zz avatar Jan 12 '21 16:01 tefod-zz