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

LazyDataModel: no need to count if first == 0 and lazyData.size < pageSize #11506

Open
cocorossello opened this issue Feb 22, 2024 · 5 comments · Fixed by #11516 · May be fixed by #11873
Open

LazyDataModel: no need to count if first == 0 and lazyData.size < pageSize #11506

cocorossello opened this issue Feb 22, 2024 · 5 comments · Fixed by #11516 · May be fixed by #11873
Assignees
Labels
⚡ performance Performance related issue or enhancement
Milestone

Comments

@cocorossello
Copy link
Contributor

cocorossello commented Feb 22, 2024

Description

Regarding DataView with lazy=true:
If first == 0 there is no need to count at the beginning and we can skip the calculateFirst method.
After the load, if the size of the loaded data is less than the pageSize, there is no need to count.

This is the case for DataView, but I believe its the same case for DataTable, DataList and DataGrid.

Count can be an expensive operation with LazyDataModel, especially when no filters are applied (first load).

It can be achieved playing with the count attribute, but it's awkward and it sometimes breaks on upgrades.

WDYT?

Describe the solution you would like

If first == 0 and loaded data size < pageSize no count() operation should be performed on the lazyDataModel

Additional context

No response

@melloware
Copy link
Member

@cocorossello were you going to submit a PR for review?

@cocorossello
Copy link
Contributor Author

I can try it, I just wanted to know your opinion before

@melloware
Copy link
Member

Try a PR it will run all our integration tests...

@melloware melloware added ⚡ performance Performance related issue or enhancement and removed ‼️ needs-triage Issue needs triaging new feature labels Feb 22, 2024
@melloware
Copy link
Member

@cocorossello PR coming?

cocorossello pushed a commit to Travelcompositor/primefaces that referenced this issue Feb 23, 2024
cocorossello pushed a commit to Travelcompositor/primefaces that referenced this issue Feb 23, 2024
@melloware melloware modified the milestones: 14.0.0, 14.0.1, 15.0.0 Feb 23, 2024
melloware pushed a commit that referenced this issue May 1, 2024
…a.size < pageSize (#11516)

* #11506 LazyDataModel: no need to count results if first==0 && lazyData.size < pageSize

* Error

* Code review changes

---------

Co-authored-by: vrossello <vrossello@travelcompositor.com>
Rapster added a commit that referenced this issue May 1, 2024
Rapster added a commit that referenced this issue May 1, 2024
@melloware melloware reopened this May 2, 2024
@melloware
Copy link
Member

@cocorossello can you resubmit your PR so we can investigate why its failing in 15.0.0?

cocorossello pushed a commit to Travelcompositor/primefaces that referenced this issue May 4, 2024
cocorossello pushed a commit to Travelcompositor/primefaces that referenced this issue May 5, 2024
cocorossello pushed a commit to Travelcompositor/primefaces that referenced this issue May 5, 2024
cocorossello pushed a commit to Travelcompositor/primefaces that referenced this issue May 6, 2024
cocorossello pushed a commit to Travelcompositor/primefaces that referenced this issue May 6, 2024
cocorossello pushed a commit to Travelcompositor/primefaces that referenced this issue May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment