I like the features of DT
package, it addresses most of my issues. One thing I noticed with DT::renderDataTable
compared to previous one is that it is very slow when filter=top
is used. I understand that it has to gather the values for factor columns and date columns, but is defeating the purpose. It feels like I have to chose between these additional features vs speed of rendering the page.
Is this normal or is there any other way to improve the speed of rendering the page while using DT with filter=top?
NOTE : I'm using that on 32 column 350k row data table
Here is the structure of rb:
Classes ‘data.table’ and 'data.frame': 357574 obs. of 32 variables:
$ 1col : chr "00000001175" "00001050760" "00002020102" "00002050202" ...
$ 2col : Factor w/ 6 levels
$ 3col : Factor w/ 22116 levels
$ 4col : Factor w/ 4 levels
$ 5col : Factor w/ 22 levels
$ 6col : Factor w/ 11 levels
$ 7col : Factor w/ 2 levels
$ 8col : Factor w/ 7 levels
$ 9col : Factor w/ 2 levels
$ 10col: Factor w/ 2 levels
$ 11col: Factor w/ 114 levels
$ 12col: Factor w/ 2 levels
$ 13col: Factor w/ 258 levels
$ 14col: Factor w/ 27 levels
$ 15col: Factor w/ 32 levels
$ 16col: Factor w/ 314 levels
$ 17col: Factor w/ 2751 levels
$ 18col: Factor w/ 7 levels
$ 19col: Factor w/ 3952 levels
$ 20col: Factor w/ 4 levels
$ 21col: Factor w/ 5389 levels
$ 22col: Factor w/ 11 levels
$ 23col: Factor w/ 27 levels
$ 24col: Factor w/ 22 levels
$ 25col: Factor w/ 2491 levels
$ 26col: Factor w/ 113 levels
$ 27col: Factor w/ 258 levels
$ 28col: Factor w/ 32 levels
$ 29col: Factor w/ 6 levels
$ 30col: chr "ABC" "CDE"
$ 31col: Factor w/ 2679 levels
$ 32col: Factor w/ 8333 levels
As a test, I converted any factor column above that has more than 100 levels to character format and that improved rendering. Rendering time came down from 40 t0 6secs