question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve performance for big Select

See original GitHub issue

I used your plugin for select with many items (~3000). Its works but take ~3mins to render with many FF warning about endless loop.

I did some modification and now it take ~6secs. The idea is first to prepare all items before adding them to DOM.


                optgroupLiTemplate = '<li class="ms-optgroup-label"><span></span></li>',
                containers = {};

                ms.find('optgroup, option').each(function(){

                        ....
                        /*
                        if (optgroupId){
                            that.$selectableUl.children('#'+optgroupId+'-selectable').find('ul').first().append(selectableLi);
                            that.$selectionUl.children('#'+optgroupId+'-selection').find('ul').first().append(selectedLi);
                        } else {
                            that.$selectableUl.append(selectableLi);
                            that.$selectionUl.append(selectedLi);
                        }
                        */

                        var container = optgroupId || 'main';
                        if(!containers[container]){
                            containers[container] = [[],[]];
                        }
                        containers[container][0].push(selectableLi);
                        containers[container][1].push(selectedLi);
                    }
                });
                for(var id in containers){
                    if (id !== 'main'){
                        that.$selectableUl.children('#'+id+'-selectable').find('ul').first().append(containers[id][0]);
                        that.$selectionUl.children('#'+id+'-selection').find('ul').first().append(containers[id][1]);
                    } else {
                        that.$selectableUl.append(containers[id][0]);
                        that.$selectionUl.append(containers[id][1]);
                    }
                }

Issue Analytics

  • State:open
  • Created 11 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
codesourcecommented, Mar 20, 2015

I did a fork and added a pull request for that. You can try it.

Firefox + Google chrome: 10’000 items (~4secs). 30’000 items, it works but take ~10secs. 100’000 items, it works but is very slow ~40-70secs

Internet explorer: 10’000 items (~4secs). 30’000 items => timeout. 100’000 items => timeout.

0reactions
sdecalomcommented, Mar 23, 2015

Ha super, it’s work fine.

Thank you very munch …

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL Query Optimization: 12 Useful Performance Tuning Tips ...
12 Query optimization tips for better performance · Tip 1: Add missing indexes · Tip 2: Check for unused indexes · Tip 3:...
Read more >
Top 10 Tips Improve SQL Query Performance - Bigscal
Do not use * in select Statment; Use Exists instead of Sub Query; Use Proper join instead of subqueries; Use “Where” instead of...
Read more >
SQL TOP statement performance tips
This article will describe some beneficial tips about the SQL TOP statement performance and its execution plan.
Read more >
Chapter 4. Query Performance Optimization - O'Reilly
One simple technique to improve efficiency is to do the offset on a covering index, rather than the full rows. You can then...
Read more >
Top 10 SQL Query Optimization Tips to Improve Database ...
Tip 1: Proper Indexing · TIP 2: Use SELECT <columns> instead of SELECT * · Tip 3: Avoid running queries in a loop...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found