primefaces: DataTable: Paging slow when using selection
Describe the bug
Having datatable with selection. Using selectionPageOnly=“false”. Tried to generate 7000 records when i found out page change is taking too long. Still not sure what exactly is wrong, but on our spring boot server, a single page change takes 2-5 minutes. Unfortunately on reproducer which is on Jetty takes less time but it is still noticable 10-15s.
-
First note is that i need to have all records selected on start / table load, that is why i put all the records inside selection list before page load instead using some ajax to call table.selectAllRows() method. I did notice when i click the unselect all and then again select all checkbox, the requests are lot faster (200-400ms) which is great…
-
Second note is that on reproducer i had to put this line in Jetty config file. These form settings might have the speed difference effect.
"<Set name="maxFormContentSize" type="int">600000</Set>"
Using Primefaces 13.0.10, but tried on 14.0.1 with the same result. Would be great to have fix made into 13.0.11 where i am waiting for similar/related bugfix https://github.com/primefaces/primefaces/issues/11885. Thank you.
Reproducer
Expected behavior
Selected record count should not have effect on page change speed.
PrimeFaces edition
Elite
PrimeFaces version
13.0.10
Theme
No response
JSF implementation
Mojarra
JSF version
4.0.6
Java version
17
Browser(s)
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21 (14 by maintainers)
Iterate through list would be a better term (traverse is more tree related) but yes, to fill
DataTable#selectionattr you need to iterate over every rowKey and find in the loaded data, the corresponding bean.I believe I did a PR in the past that got reverted for some reasons, but anyway using lazy mode is the easiest/quite efficient way to go about it
Yes, it’s one single rowKey (it’s an alias, nothing to do with PFS
@allbtw…) that says “all row keys” which will run the algorithm much faster as it is only one rowKey (and not 7000…)Because pagination triggers a new HTTP request, and therefore requires to decode the dataTable component. I guess there could be a way of improving the algorithm, but in a situation like yours, you’re supposed to use lazy mode, so not sure it worth the effort to cover this use case
Hi, I tested the reproducer project from @chaloma1 with following scenario:
Please see attached GIF with this scenario:
The scenarios I was talking above were the two situations from jprofiler - 12s call (with quadratic complexity) vs 40ms call