select2 performance for large lists

3,530 views
Skip to first unread message

jamespatr...@gmail.com

unread,
May 21, 2013, 12:39:48 PM5/21/13
to sel...@googlegroups.com
Hi, this is a very cool piece of sw,but had some performance questions.
I have a list of around 10,500 entries. I've noticed when I click on the dropdown to expose the list, it takes about 5 seconds before it renders the list. And then when I start typing filter text, it takes about 3 seconds for my text to appear and filter.

First, is this expected behavior with large lists? Or are there some ways or constructor properties I can tweak to optimize performance? Right now I'm pretty much just using default behavior, just setting the width/dropdownAutoWidth props.

Secondly, is there any idea as to what the recommended list size limit is in order to maintain responsive performance? Like a guideline that you shouldn't use lists more than 5000 or 1500 entries or something?

Thanks!

Igor Vaynberg

unread,
May 21, 2013, 12:53:44 PM5/21/13
to sel...@googlegroups.com
On Tue, May 21, 2013 at 9:39 AM, <jamespatr...@gmail.com> wrote:
> Hi, this is a very cool piece of sw,but had some performance questions.
> I have a list of around 10,500 entries. I've noticed when I click on the dropdown to expose the list, it takes about 5 seconds before it renders the list. And then when I start typing filter text, it takes about 3 seconds for my text to appear and filter.
> First, is this expected behavior with large lists? Or are there some ways or constructor properties I can tweak to optimize performance? Right now I'm pretty much just using default behavior, just setting the width/dropdownAutoWidth props.

this is the expected behavior if you are writing out all of your
entries into the initial html. the idea behind select2 is that you do
not do that. instead, you use ajax and pagination to load relevant
subsets of data one at a time - which makes it much more efficient.

if you wan to keep using local data you can write your own query
function to do so. there is an example at the end of this issue:
https://github.com/ivaynberg/select2/issues/849

>
> Secondly, is there any idea as to what the recommended list size limit is in order to maintain responsive performance? Like a guideline that you shouldn't use lists more than 5000 or 1500 entries or something?

this really varies per browsers. chrome can handle much larger lists
than IE, for example. but once you implement pagination you can handle
huge lists without many performance penalties.

-igor


>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups "select2" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to select2+u...@googlegroups.com.
> To post to this group, send email to sel...@googlegroups.com.
> Visit this group at http://groups.google.com/group/select2?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Emma Snow

unread,
Sep 20, 2025, 5:10:47 AMSep 20
to select2
Hausfit offers reliable AC maintenance Dubai services to keep your cooling systems running smoothly. From regular servicing to urgent repairs, their experts ensure comfort and efficiency at home. With professional care, Hausfit makes maintaining your AC simple and hassle-free.
Reply all
Reply to author
Forward
0 new messages