-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
A more performant updateOriginalInput #1460
A more performant updateOriginalInput #1460
Conversation
Previously, on every call to updateOriginalInput(), a brand new array of options for every value in selectize.items would be created and the entire HTML string would replace all children of the raw input source. When doing something like selectize.addItems(_.keys(selectize.options)); for a few hundred options, this becomes very sluggish. This takes a smarter approach, only removing and adding individual options from the input source as necessary. The bottleneck is the repeated use of jQuery's html() method with large DOM updates. For ~300 options this was originally taking 30154ms in appendChild. Now it spends only 330.9ms.
I didn't review the code but the change looks interesting and useful. Good job 👍🏻 As you can there are errors with Travis CI. |
I don't plan on putting any more work into this. |
Stale pull request message |
It would be a shame for this PR to get auto-closed out by a Github action. While I cannot comment on a recent version of selectize, at the time the code in this PR was the difference between the dropdown box being unusable vs very performant. As I mentioned 1.5 years ago, I won't be putting more work into this, but if it hasn't otherwise been fixed it'd be a shame not to not see the performance boost make it into a release. |
Update on this PR, I haven't merged it yet because it is causing tests to fail; however I'm not particularly sure that the original code is working quite correctly, so until I can determine what the correct behavior is, this is going to sit in the pending queue for a bit |
Escaping fresh.push('<option value="' + escape_html(value) + '" selected="selected">' + escape_html(label) + '</option>'); |
Rebased, updated and merged in new PR #1895 |
See #910 for context.
This is a new PR rebasing the last 3 years of changes in
master
.