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

Use createDocumentFragment to append options to DOM #586

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Gotenks-J
Copy link

I've bumped into a performance issue using slim-select when lots of options are repeatedly added/removed from the DOM as part of renderOptions.

We use the search event to query an endpoint that returns >7,000 records. This causes each option to be individually added/removed from the DOM, this can cause slowness for our application if a user searches multiple times.

With this change, instead of adding each option to the DOM one-by-one and performing lots of modifications. We create a document fragment and append to that, once all options have been processed we append the document fragment to the DOM.

I'm working on benchmarking this to support the change but, anecdotally, I am seeing an improvement in responsiveness using this change locally.

Let me know if you have any concerns with this change 👍

@brianvoe
Copy link
Owner

Ohh interesting. I would say if your loading 7,000 of anything you have a search issue on your hands.

That being said im all for MORE SPEED! So if you have the proof, showcase it here and if everything works ill get that pr merged in super quick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants