Improve performance for big Select
See original GitHub issueI 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:
- Created 11 years ago
- Comments:13 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
Ha super, it’s work fine.
Thank you very munch …