-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Performance issues #88
Comments
I can't find it, can you upload an example or point where on the src its used? |
Seams like this is related to #49 code |
Having the same issue. The batarang chrome developer tools extension (https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk?hl=en) exposes this issue. Removing the code that highlights the list item that you're hovering over improves performance noticeably, but it is still very slow. Doesn't appear to be related to #49. See line 903 in dist/select.js for more info.
|
I saw the same thing in my app. I removed the isActive component and still have the same performance problem. It seems that if you load more than 10 ui select directives on the same page, the page becomes frozen for 5-6 seconds. I am using Mac OSX with the latest version of chrome. I believe the performance issues are due to the ng-repeat mechanism in the ui-select-choices directive. I commented out this section of the code and the app became responsive again. It appears that the select dropdown list of choices is getting processed immediately, instead of when it is clicked on. If you have (several choices * several select-ui search boxes) on the same page it will slow down page load tremendously. I believe the solution is to delay the processing of the dropdown choices until a select-ui search box is clicked on, but I am still investigating... The project I am using this with has one ui-select box per user. For large accounts with 50-150 users, loading can take about 15 - 30 seconds or cause chrome page to crash. |
Any update on this? Same performance issues here aswell. |
This is not a permanent fix, but what I did was created a ng:if where I disabled the angular ui-select if the object was empty (e.g. no options selected). So for the directive to render a user must press on a button and then the UI renders. This prevents about 80% of the ui-selects from rendering on page for me and solved the problem. My case is multi-select just to be clear. Here is some sample code
|
Thanks but I have only one ui-select with roughly a thousand options. On IE9 it is pretty much unusable. |
yeah guys, this is really bad. |
ok I worked around this by doing repeat="...... | limitTo: 100", so we don't show a huge list of items. |
@gjoliver |
Any update on this? This is kind of a dealbreaker for me. I am migrating from Kendo, and have a dropdown with over 5000 items. In Kendo it opens, loads and filters in ms, in ui-select it's sluggish and often freezes the browser. |
I'm having the same issue with around 500 items. Sometimes the performance gets so bad that the browser actually crashes! |
Also a problem for me. I can't do the limitTo: 'myNumber' trick because it doesn't allow previously selected items to be pre-populated unless they're within the first 'myNumber' of my source. |
Very recently (~ week ago) performance dropped even further. I have problems with a list of 103 items. |
I recently switched from ui-select to angular-selectize due to performance. I'm dealing with lists of ~500 entries each and typing to filter is unacceptably slow. |
@mareczek +1 |
what about "suspending" the watchers instead of using ngIf (which stresses DOM on long lists)? |
+1 |
The performance issues are due to the ng-repeat mechanism in the ui-select-choices directive. Like askhogan said the dropdown list are getting processed immediately. |
The performance issues are due to angular design who makes you build slow apps e and slow components. It's a sad lesson I've learned using ui-select and trying to make it faster for my use case (country dropdowns). In my next project I'll probably look elsewhere (aurelia.io, react, etc..). @pitieu the hover problem is maybe the easieast to fix in the "angular way". The ng-mouseenter (as any other angular directive or service) calls a full scope digest while a $select digest should be enough, as far as activeIndex is not intended to be used outside the dropdown scope. The way I solved my specific use case is a dirty hack. I've replaced the ng-repeat with a loop that rebuilds the entire dropdown content as a string. I don't know if this approach can be used by ui-select itself without breaking some piece of code (it probably would). |
Wow, this is a really old thread with no milestone set! Thanks for the vote of confidence. 😕 |
I think in general, github should enable voting per issue, to make transparent where most problems are or what users are most interested in. (of course the motivation/drive of every open source project is always different) I can imagine many would be voting for this issue. |
@igorlino most people just use a 👍 comment to increase interest or resurrect old issues but I agree that this seems like more of a work-around than a feature. Just as well, you can "subscribe" to issues without directly making a comment and this demonstrates increased community interest in resolving issues. |
I think this is related: #389 |
👍 I am also stunned by the slow performance, even on small arrays (< 300 items). |
Seeing the same issue 👍 |
With #1211 there should be some improvement |
@dimirc there is but not enough to close these issues. |
To activate the dropdown select choice only after x letter are typed :
Than you have : In controller
|
Is there an option to load only first 100 then load more as the user scrolls down? |
I am affected by this issue, too. |
Anybody that will solve this problem? |
Sad to say, but after applying all hacks that I could, including the scrolling filter trick, it was simply not sufficient. So some radical change had to be done... What did work, and is quite quite performant was to simply switch to another component https://github.com/machineboy2045/angular-selectize The disadvantage is that is a wrapper to a jquery based component, and does not offer all the themes options. The advantages are that the directive is very very small, the configuration of it is mostly not in the HTML but in the controller, so the HTML is much easier to read, configure and REUSE. As the select does not know anything about angular, it also does not inherit Angular performance problems. |
@igorlino your update appears to be related to angular-selectize library not ui-select. It doesn't appear to help resolve any problems with performance or add meaningful information to what has already been drescribed. Can I ask that future posters contribute meaningful updates to the issue. Useful updates:
+1's are not helpful (please use github reactions), open issues are still outstanding and need to be addressed. Again, PRs are more help than posting in issues. Thanks all! 😺 |
Currently ctrl.isActive = function(itemScope) {
// ...
var itemIndex = ctrl.items.indexOf(itemScope[ctrl.itemProperty]);
var isActive = itemIndex == ctrl.activeIndex;
// ...
}; It might be possible to improve isActive() by storing an Which would reduce isActive() to: // Gets active item from active index somehow, needs to
// account for changes to activeIndex and activeIndex value
// when using tagging
var activeItem = getActiveItem();
ctrl.isActive = function(itemScope) {
// ...
var item = itemScope[ctrl.itemProperty];
var isActive = item == activeItem;
// ...
}; |
The filtering logic of ui-select is heavy. The ui-select/src/uiSelectController.js Lines 521 to 574 in 9d29307
|
I am going with a pagination support that works on scroll. It could be the raw list or the filtered list which may also be bad. |
This should help with performance, as per angular-ui/ui-select#88 (comment)
@yogeshgadge add clear to multiple ui-select will stop populating the dropdown
Plunk below Any idea how to fix that? |
Guys, we are suffering some serious performance issues. Does anyone know what is this $select.isActive(this) ?
The text was updated successfully, but these errors were encountered: