Performance Regression: Scroller plugin does not respect window size after first pagination request

Performance Regression: Scroller plugin does not respect window size after first pagination request

sebastianbarthsebastianbarth Posts: 43Questions: 11Answers: 0

Link to test case:
https://live.datatables.net/reyokava/2/edit

Debugger code (debug.datatables.net):
https://debug.datatables.net/ifonay

Datatables: 1.13.6 (latest)
Scroller plugin: 2.2.0latest)

Error messages shown:
none

Description of problem:
After the first pagination request every small scroll change will result in a pagination request which kills performance and somewhat destroys the purpose of the scroller plugin this way. Instead, the window size should be respected.

Reproduction steps
* Open the test case from URL above in a Chrome-based browser (does work well in FF)
* Scroll until a first subsequent pagination request occured ("data request" printed in the console)
* Scroll further by just a few pixel, which will cause an unnecessary data request ("data request" printed in the console)

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    It looks like the issue is because you have paging enabled. As you're using Scroller, you can remove that as it has no purpose.

    With that line removed, I'm not seeing the issue, the request is only made every 243 lines. Does that work for you too?

    Colin

  • sebastianbarthsebastianbarth Posts: 43Questions: 11Answers: 0
    edited September 2023

    Hi @colin,
    thanks for the quick reply. When I deactivate paging option I get a popup telling me that (in production code and provided test case):

    DataTables warning: table id=DataTables_Table_0 - Pagination must be enabled for Scroller

    I am confused. How did you test it? Any idea?

  • sebastianbarthsebastianbarth Posts: 43Questions: 11Answers: 0
    edited September 2023

    I now tried versions down to:

    "datatables.net": "1.10.25",
    "datatables.net-dt": "1.10.25",
    "datatables.net-scroller": "2.0.5",
    "datatables.net-scroller-dt": "2.0.5"
    

    Also tried with:

    "jquery": "3.6.0"
    

    It always is the same behavior in Chrome-based browsers, so I assume there is a change in the browser some time ago that came unnoticed.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    That's definitely not the case about the pagination dependency, as you can see in this Scroller example. When I tried it before, I just commented out that paging line in your example.

    The versions you listed above are old. DataTables is on 1.13.6 now, Scroller on 2.2.0, so it would be worth grabbing the recent packages and seeing if those help.

    Colin

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Just to clarify - paging is 100% required for Scroller to operate. It is default enabled in DataTables which is why the example that column linked to works. Colin noted, correctly (albeit for the wrong reason ;)) that you can remove it from your initialisation, because it is default enabled. Scroller also uses CSS to remove the pagination controls from view - so it looks to the user like it isn't present, but its logic is used internally.

    Removing it from your original example won't make any difference, since it was just setting paging to true, which is already was (by default).

    So all that said, it does look like there might be an error in Scroller with the nightlies that your example is using. Updating it to show the start and length parameters I can see:

    data request 0 243
    data request 12 243
    data request 40 243
    data request 62 243
    data request 154 243
    data request 174 243
    data request 242 243
    

    I'd have expected the gap to be a bit larger. So there is something that I need to look into there.

    Thanks for flagging this up!

    Allan

  • sebastianbarthsebastianbarth Posts: 43Questions: 11Answers: 0
    edited September 2023

    Thanks for the clarification.

    When I use the arrow keys on the keyboard (that possibly also depends on the screen size) it updates less frequently (like expected?) than when scrolling via scroll wheel or scrollbar using the mouse. With mouse-based scrolling it is enough to scroll by 1 row to trigger an update.

    What is weird is that when reducing the line count from 5000 to 500, I can scroll much farther without triggering a data request. I can even notice a difference between 1000 and 500 rows.

    BTW: You 'Update' link does not include any output of the scroll distance

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Ah sorry. I literally just echoed out the start and length parameters. I'll need to do more debugging in Scroller itself to properly understand what is going wrong.

    Allan

  • sebastianbarthsebastianbarth Posts: 43Questions: 11Answers: 0

    Hi allan,
    could you make any progress on this?
    Anything I could provide to support you?

  • sebastianbarthsebastianbarth Posts: 43Questions: 11Answers: 0

    We now have upgraded:
    datatables.net from 1.3.6 to 1.3.8
    datatables.net-scroller from 2.2.0 to 2.3.0

    The error now is less prominent but still there: It happens when scrolling right after a paganiation request has been resolved. For example I triggered a fetch starting at 2828 and requesting 297 lines, then scrolled very quickly after and it fired a request for index 2830 requesting 297 lines.

  • sebastianbarthsebastianbarth Posts: 43Questions: 11Answers: 0

    Hello @allan ,

    this issue still exists with the newest version:
    https://live.datatables.net/reyokava/13/edit (don't forget to enable the console output)

    This is extremely annoying, especially for big tables (100 columns x 150 rows = 15,000 cells) where just the rendering of the td elements takes 1-3s.

Sign In or Register to comment.