mikemclin / angular-acl

Role-based permissions for AngularJS
196 stars 49 forks source link

Use Reverse loop to Improve read Performance; #4

Closed tplaindoux closed 9 years ago

tplaindoux commented 9 years ago

that's just a minor optimization, but Acl will use a lot the indexOfquery to determinate whether an user can or cannot access a page/ do something.

Mind changing the loop to increase a bit the performance ? http://jsperf.com/fastest-array-loops-in-javascript/295

I'd recommand:

var l = arr.length;
for(;l--;) {
  someFn(arr[l]);
}
postLoop();