filamentgroup / tablesaw

A group of plugins for responsive tables.
MIT License
5.48k stars 434 forks source link

Tablesaw choking with large data sets? #374

Closed seyfer closed 2 years ago

seyfer commented 5 years ago

Chrome and Firefox just getting stuck with datasets more than 1000+ rows.

We have faced the issue and limited our tables to 200 rows. We use tablesorter https://github.com/Mottie/tablesorter without any widgets. And also we use tablesaw https://github.com/filamentgroup/tablesaw lib on the same table.

After debugging we think it might be connected somehow to this issue, is it possible? jquery/sizzle#342

UPD. seems like it is more about tablesaw, Here is a stack trace

Error: Script terminated by timeout at:
./node_modules/jquery/dist/jquery.js/</Sizzle</Sizzle.uniqueSort@http://host.loc/build/backend/vendors~js/base~js/bbc~js/cluster-dashboard~js/competition~js/dashboard~js/distribution~js/external-~8997b080.js:1566:2
add@http://host.loc/build/backend/vendors~js/base~js/bbc~js/cluster-dashboard~js/competition~js/dashboard~js/distribution~js/external-~8997b080.js:3104:4
./node_modules/tablesaw/dist/tablesaw.jquery.js/</</Table.prototype.isCellInColumn@http://host.loc/build/backend/vendors~js/bbc.js:9517:5

As you can see, somewhere Sizzle.uniqueSort was used, and it causes the problem.

seyfer commented 5 years ago

This is the exact line which gives the problem. tablesaw/dist/dependencies/jquery.js:2560

// Seedless set matches succeeding multiple successful matchers stipulate sorting
                if ( outermost && !seed && setMatched.length > 0 &&
                    ( matchedCount + setMatchers.length ) > 1 ) {

                    Sizzle.uniqueSort( results );
                }
gibson042 commented 5 years ago

https://github.com/jquery/sizzle/issues/342#issuecomment-487648220

that call to uniqueSort is specific to use of multiple positional matchers like :first, :last, :even, :odd, :eq(N), :lt(N), and :gt(N), all of which are ill-advised and deprecated. I recommend rewriting the logic to avoid using those nonstandard selectors, or at the very least to using no more than one at a time, in which case the slow sorting will no longer be necessary.

seyfer commented 5 years ago

@gibson042 thank you. I hope this will help maintainers to fix it.