Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High CPU usage when Grid page size is set to a large value #6648

Open
pepijnve opened this issue Sep 17, 2024 · 0 comments · May be fixed by vaadin/web-components#7808 or #6649
Open

High CPU usage when Grid page size is set to a large value #6648

pepijnve opened this issue Sep 17, 2024 · 0 comments · May be fixed by vaadin/web-components#7808 or #6649

Comments

@pepijnve
Copy link
Contributor

Description

Setting the page size of a Grid to a very large value can lead to browser side hangs even if the data provider does not contain many items.

Expected outcome

I would expect the performance of the Grid to be proportional to the actual number of items in the data provider rather than the potential number of items in a page.

Minimal reproducible example

Grid g = new Grid();
... add a data provider with a small number of items
g.setAllRowsVisible(true);
g.setPageSize(Integer.MAX_VALUE / 10);

Steps to reproduce

Add the above snippet to a view

I'm not sure what the requirement is to trigger the code path, but you want to reach line https://github.com/vaadin/flow-components/blob/main/vaadin-grid-flow-parent/vaadin-grid-flow/src/main/resources/META-INF/resources/frontend/gridConnector.ts#L513 with items being undefined.

This will cause an empty Array to be created of size pageSize which then needs to be iterated over. If pageSize is some huge value this will cause the browser event loop to hang for a while.

Environment

Vaadin version(s): 24.4.11
OS: macOS

Browsers

Issue is not browser related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant