Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Performance issue with setHeightByRows #918

@mas4ivv

Description

@mas4ivv

Using a simple Grid with a large number of cells leads to extreme performance issues when setHeightByRow is true. Simple example:

@route("")
public class MainView extends VerticalLayout {

public MainView() {
    List<List<String>> items = new ArrayList<>();
    for (int i = 0; i < 5000; i++) {
        items.add(Arrays.asList("A\n" + i, "B" + i, "C" + i));
    }
    Grid<List<String>> grid = new Grid<>();

    grid.addColumn(item -> item.get(0)).setHeader("A");
    grid.addColumn(item -> item.get(1)).setHeader("B");
    grid.addColumn(item -> item.get(2)).setHeader("C");

    grid.setDataProvider(DataProvider.ofCollection(items));

    grid.setHeightByRows(true);
    this.add(grid);
}

}

When increasing the number of cells the rendering time grows exponentially. It took up to 8 minutes in our real app, setting setHeightByRows to false brought us back to 5 seconds.

Chrome gives a hint: it seems that every new cell forces all existing cells to recalculate their size.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions