Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Grid Performance Issues
I'm experiencing performance issues after replacing our use of the Table component with the Grid. What we see is that if we populate the Grid with 1000 rows x 120 cols then once our code returns control to the framework, it then takes a further 20secs before the UI updates and is responsive.
We're populating the Grid using an IndexedContainer, which we create a new instance of for each query. The grid is set to have multi-level column headers (usually 1-4 rows), and we have 1 frozen column. The row headers use joining, so some headers span multiple columns (I've tried commenting this out but it makes no difference to the performance). ImmediateMode is set to false.
The problem seems to be proportional to the number of columns. It also appears to be worse on subsequent runs - e.g. first time takes 10secs, subsequent times take 20secs.
For each run we create a new instance of the container and set it onto the Grid:
while(table.getHeaderRowCount() > 0) {
table.removeHeaderRow(0);
}
table.removeAllColumns();
table.getContainerDataSource().removeAllItems();
table.setContainerDataSource(resultContainer);
table.setFrozenColumnCount(1);
// Rebuild the multi-level column headers...
Any idea how I pin this down? As I said, the delay occurs after our code has completed, so I'm not sure how I debug this.
I'm using Chrome (51.0.2704.63 (64-bit)) and Vaadin 7.6.8 (I noticed the same problem with 7.6.4).
Known issue.
Suggested workaround is use Spreadsheet not the Grid.
https://vaadin.com/forum#!/thread/13624019
I've also found that if you manually set column widths it cut down rendering time a little.
You can use superdevmode and profiler tools in Browser those give quite detailed inforamation what methods takes long.
Thanks for that. This comment is interesting:
Grid is by design not optimized for "spreadsheet-like" use
So Grid, the new high-performance replacement for Table, is actually slower for "spreadsheet-like" usage, The latter term includes even moderately large numbers of columns (20+).
They really should make the limitations of Grid clear in the documentation. I spent several days rewriting my code to use Grid (mostly to use to use the new multi-level row headers), and another few days investigating this perf issue and trying various fixes to avoid it, and now it looks like I will have to port it back to Table.
Unfortunately, Spreadsheet is a commercial product, and my use case is for a simple support tool so this is not an option.
Do you have any sense of whether a fix is in the pipeline for this?