Slow TableListBox with large number of columns (think 1000s) w/ hack fix

Has anyone tried to use a TableListBox with large number of columns? I tried, and it gets very very slow and the problem is the code at:

https://github.com/julianstorer/JUCE/blob/master/modules/juce_gui_basics/widgets/juce_TableListBox.cpp#L42

and

https://github.com/julianstorer/JUCE/blob/master/modules/juce_gui_basics/widgets/juce_TableListBox.cpp#L77

Basically we are going through all the columns even though most of them are not going to be visible in the viewport. We should really be figuring out what columns are actually visible and only iterating through them. I have hacked the code to change the for loop to refer to the viewport instead:

for (int x = owner.getViewport()->getViewPositionX(),
         columnId = owner.getHeader().getColumnIdAtX(x),
         i = owner.getHeader().getIndexOfColumnId(columnId, false);
     x < owner.getViewport()->getViewPositionX() +
         owner.getViewport()->getViewWidth() +
         owner.getHeader().getColumnWidth(columnId);
     x += owner.getHeader().getColumnWidth(columnId), columnId++, i++)

This seems to work, but I am not sure if this is the best solution to just go through the visible columns in the RowComp. Any ideas on a better way to do this? Of course, I was really just looking for a multicolumn ListBox to show 1000s of sample files in a horizontally scrolling grid...maybe I should try to just hack ListBox directly.

Thanks,

-Atin

Yes, it was definitely designed for many rows and few columns!

I've done a bit of optimisation for the paint routine - that's easy enough, but the update method really can't be changed like that. It could be optimised in a case where you don't have any custom cell components, but would mess-up if people needed to populate the table with custom components.. It could be possible to refactor the whole algorithm to do it more efficiently (same way that custom row components are handled sparsely) but that'd be a bigger task than I have time to do right now.

Thanks Jules - I was wondering about custom components too (mine is a simple text output for the sample file name...). The hack serves my purpose, I have a 2500 (38000 samples...) column table scrolling along happily but will think about how to do this better if my cells are custom components.

 

-Atin