-
Notifications
You must be signed in to change notification settings - Fork 753
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
Pager widget - slow table update when there are a large number of page number links #711
Conversation
Hi @camallen! It's interesting that this isn't an issue at all in webkit... I changed the code to add 25000 options and I didn't notice any difference. The problem does occur in Firefox and IE. I believe the fastest way to concatenate is using strings... I tried this test with the more modern browsers and oddly Firefox totally blew away the other browsers making the graphs hard to read. I did notice a significant delay when using jQuery's So, I do like your idea of limiting the option steps; but I won't accept your pull request as-is because it seems that the building, then joining of an array is still slower than string concatenation. Either way, some more testing needs to be done and to determine why Firefox isn't behaving properly. Also, I will change that one line to read like this: // p.$goto.html(t).val( p.page + 1 );
p.$goto[0].innerHTML = t;
p.$goto[0].value = p.page + 1; |
Oh, I forgot to mention... as an alternative to using a dropdown select, the output: '{page:input} / {totalPages}' You can see this working on in the pager demo |
65a3572
to
ba10ffb
Compare
Hey @Mottie, your totally correct re string concatenation vs array buffer. I've specifically tested for long strings as well - http://jsperf.com/stupid-long-string-concatenation. As such I've removed the offending commit and reworked the PR. I think the It's a pretty neat solution changing the page option selector to an input. The user would have to calculate the page but it avoids this issue completely. Unfortunately I can't use this just now as I am using an older version of the library. I need to invest some time upgrading my code to work with the newer version. |
Hi @camallen! Yes, please add an option! :) So if I understand the logic... basically, if the number of pages is greater than the max option size, the dropdown will skip every max option size number? I think it might be nice to have that number reduced around the current page. For example, if
What do you think? |
The logic is slightly different, if the number of pages ( I see what you want to do have greater page visibility around the current page, I'll have a look at it. |
I've added a focus set around the current page number, it could probably do with a refactor to a function as well. I've also extracted to the maxOptionSize to pager widget default. I haven't touched the documentation not tested if the configuration option being overridden. Let me know what you think. |
Hey @camallen! Sorry, I totally forgot about this pull request. I'll try to work it into the next update. Any chance you could update the pull request to make it easy to merge? |
Large collections will have a large number of page links. The browser slows noticeably when inserting the large page links collection into the DOM.
c63e6cd
to
74163cf
Compare
@Mottie - just rebased of the latest master. |
Pager widget - slow table update when there are a large number of page number links
I am using the pager widget with server side filtering. When paged results where being returned the pager's 'goto' page links get updated. For large page sets the browser slows noticeable (sometimes even causing unresponsive script errors) while inserting / replacing a large list of 'option' goto page links.
You can simulate the issue by replacing
pg = Math.min( p.totalPages, p.filteredPages );
with a large value, my page set was something like 25Kpg = 25000;
and then watch your browser slow down on renderI couldn't get a faster DOM insert / update mechanism working properly, see:
Instead I've created a representative sample into the set of "page options links", selecting a page based on a 'max_option_size' value, e.g.
select_every_x_records = 'total number of pages' / max_option_size
.This might not be a great solution for everyone but it works for me. Perhaps this PR will save someone a few hours and possibly start a discussion re large page links sets slowing down the browser.