Hi Jonathan,

I went quickly over your plunk and found a number of small issues. Not that 
you did anything wrong, but often you opted 
for the most expensive way (from a performance view). all those small 
things combined makes your solution feeling a bit sluggish.

compare those 2 functions, and then remember that those get called a lot!
```
    getShortcutIndex = function(id) {
        for (var i = 0; i < $scope.shortcut.length; i++) {
            if (id === $scope.shortcut[i].SHORTCUTID) {
                return i;
            }
        }
    }

    getShortcutIndex = function(id) {
        var i=0 , l =  $scope.shortcut.length;
        while (id !== $scope.shortcut[i].SHORTCUTID && ++i<l) {
            //just loop
        }
        //only return i if there is indeed a match.
        return id !== $scope.shortcut[i].SHORTCUTID ? i : null;
    };

```

The first one traverse the entire array every time!. Also you are 
generating a awful of DOM that is not needed. 
I did put in a directive counter, and in your orginal version it counted 
1122 shortcut-new directives being generated.
User filters and ngIf to only show the items you need on screen. In te 
atached updated plunk I putted in just a couple of ngIf in stead of ngShow
and the count dropped to 5!!!
There is still a lot to be won. while it still only fires 5 directives, 
your solution has to do the looping for all, on every change...
I would replace the second nested ngRepeat with a singe one looping over 
the shortcut array and use a filter to get only the 'active' ones. 
that reduces the number of loops quite a lot!
Have a look for yourself.

here is the updated 
plunk: http://plnkr.co/edit/oBUCFkWndGem3PG3LHb2?p=preview

If you have additional questions, don't hesitate to ask them!

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to