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

suggestion performance problems #157

Closed
turiartt opened this issue Sep 30, 2011 · 19 comments
Closed

suggestion performance problems #157

turiartt opened this issue Sep 30, 2011 · 19 comments

Comments

@turiartt
Copy link

Hello, I experienced performance problems when more than 2000 options. To took an average of four minutes to assemble the combo (bad machines), not to mention when you click on or search.

modified the section:
this.element.find('option').each(function( i ){

changes:

  • changed the "each" by classic "array".
  • "html" var, is not an array, pass by simple string. Don't use ".push" and uses "+=";

with these changes, the time fell to below 1 minute.

Att,

@turiartt
Copy link
Author

turiartt commented Oct 7, 2011

Another...
in "jquery.multiselect.filter.js" file, just in IE7 or running in compatibility mode.

The line "this.inputs = instance.menu.find('input[type="checkbox"], input[type="radio"]');" the comma uses force "SortOrder , siblingCheck" functions in jQuery. And in large quantities to create renders slow as to lock the browser. I suggest a simple change:

this.inputs = instance.menu.find('input[type="checkbox"]').get();//, input[type="radio"]');
this.inputs.push(instance.menu.find('input[type="radio"]').get());

@codeulike
Copy link

I've found creation of the widget to be very slow with 1000+ options, especially on IE8 and IE7.

(Also in IE7 making a multiselect with 1000+ options tends to go over the script-instruction limit so that you get a warning saying "A script on this page is causing Internet Explorer to run slowly")

Hence I am very interested in these changes!

@turiartt
Copy link
Author

turiartt commented Nov 3, 2011

IE7 sucks!!! EHEHEHEH

Changes are easy:

in "refresh: function( init ){"

change html var to string "html = ''," and the ".push" became a "+=". The
same for "labelClasses".

For even best results, use jQuery 1.6.4 or over.

Att,

Tiago Uriartt

On Thu, Nov 3, 2011 at 1:08 PM, codeulike <
reply@reply.github.com>wrote:

I've found creation of the widget to be very slow with 1000+ options,
especially on IE8 and IE7.

(Also in IE7 making a multiselect with 1000+ options tends to go over the
script-instruction limit so that you get a warning saying "A script on this
page is causing Internet Explorer to run slowly")

Hence I am very interested in these changes!


Reply to this email directly or view it on GitHub:

#157 (comment)

Algo diferente? Visite o meu site: www.uaza.com.br.
Boas fotos? www.uaza.com.br/album.
Futuramente... www.plantae.com.br

@codeulike
Copy link

Hmm, in my situation (IE7, IE8, 1000+ options) neither of the suggested changes made any difference.
Back to the drawing board....

@turiartt
Copy link
Author

turiartt commented Nov 3, 2011

i try eliminate de filter file, put "allinone", 1 loop do all, but the
diference was little...

On Thu, Nov 3, 2011 at 1:53 PM, codeulike <
reply@reply.github.com>wrote:

Hmm, in my situation (IE7, IE8, 1000+ options) neither of the suggested
changes made any difference.
Back to the drawing board....


Reply to this email directly or view it on GitHub:

#157 (comment)

Algo diferente? Visite o meu site: www.uaza.com.br.
Boas fotos? www.uaza.com.br/album.
Futuramente... www.plantae.com.br

@garyzhu
Copy link

garyzhu commented Jan 18, 2012

@codeulike

I found a minor performance enhancement you can try. It makes the biggest difference in IE 7 & 8.

In update() and _toggleChecked()
replace
this.labels.find('input')
with
this.labels.children('input')

It's about 10x faster in IE 7 and 8. For a 1000 item list, on my computer, dynaTrace shows that find() took about 695ms, but children() only took about 65ms. So, it should decrease the widget create time by about 50%. The change in toggleChecked, means that check-all and uncheck-all will also be about 40 or 50% faster.

ehynds pushed a commit that referenced this issue Jan 24, 2012
@ehynds
Copy link
Owner

ehynds commented Jan 24, 2012

Also commit acb202d

@lgemeinhardt
Copy link

To speed-up IE (7x) using simple text nodes - please replace
this.innerHTML
with
(this.childNodes.length==1 && this.firstChild.nodeType==3)?this.firstChild.nodeValue:this.innerHTML

@lgemeinhardt
Copy link

To speed-up IE please replace
this.labels.find('input')
with
this.labels.children('input')
and the innerHTML (above) fix also within "jquery.multiselect.filter.js" and speed-up the value map while replacing
var values = $inputs.map(function(){
return this.value;
}).get();
with
var values = new Object();
$inputs.each(function(){
values[this.value]=true;
});
and replacing
$.inArray(this.value, values) > -1
with
values[this.value]
in both javascript files (normal and filter)!

@deadend5001
Copy link

deadend5001 commented Feb 8, 2012

I can confirm the issue everyone is facing above. I had a IE8 and 7 user report this exact same problem. We recently added mutliselect jquery to all of our multiple select boxes to enhance their functionality. on a few pages we have lists of 2000-3000 items easy and IE7 and 8 users were getting a stop script error. I have patched my local files with all of the recommended changes above and they work.

@ehynds
Copy link
Owner

ehynds commented Aug 20, 2012

fyi a lot of this stuff was released in 1.13 over the weekend.

@timmorehouse
Copy link

Thanks! The new release fixed the stop script error for the users on IE7.

@cnunlist
Copy link

The minified versions of the files haven't been updated (I don't think). Also, while the new version does eliminate the stop script error in IE7/8 for me, it is still pretty slow - and several of the fixes recommended above are not in the current version. deadend5001 - I tried to find a way to email you on your profile but couldn't find it - anyone want to help a noob out with that?

@cdma59
Copy link

cdma59 commented Oct 10, 2012

Hello,
Ehynds, i have tried 1.13 on my website because 1.12 slow on IE, but it seems no change
Can you help me ?
Regards

@k2kkapoor
Copy link

I am facing performance issue on IE 11, can you send me the modified files as well at the earliest.

@mlh758
Copy link
Collaborator

mlh758 commented Jul 19, 2016

@k2kkapoor You may want to use the latest versions from master here on Github. There has been 3 releases since this thread was opened in 2012 and some additional fixes beyond the latest release as well. The minified files haven't been updating with anything past 1.15 but you can minify them yourself if you need those last changes.

@k2kkapoor
Copy link

@mlh758 : Can you please provide me link to the latest multiselect.js and filter.js file.

@mlh758
Copy link
Collaborator

mlh758 commented Jul 19, 2016

This is the GitHub repository for multiselect, so they're stored here, where you are currently commenting. This is a direct link within the repo though: https://github.com/ehynds/jquery-ui-multiselect-widget/tree/master/src

@mlh758
Copy link
Collaborator

mlh758 commented Jul 19, 2016

I added another of the suggested fixes to the source code - looking up values by key instead of searching an array is a good idea. I'm not going to be swapping find for children however. In the years since this was opened find has become much faster than children. There will be a commit incoming shortly for this.

I'm also going to delete some of the old comments in here where people are just asking for source code. That isn't going to be helpful for future users to understand what happened here.

@mlh758 mlh758 closed this as completed in c7cccca Jul 19, 2016
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

No branches or pull requests