Skip to content

Commit

Permalink
call is faster than binding the function in forEach
Browse files Browse the repository at this point in the history
  • Loading branch information
rogueSkib committed Nov 18, 2014
1 parent a7f3e13 commit 3f02512
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/ui/ParticleEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,8 @@ exports = Class(View, function (supr) {
*/
this.forEachActiveParticle = function(fn, ctx) {
var views = this._activeParticles;
var f = bind(ctx, fn);
for (var i = 0, len = views.length; i < len; i++) {
f(views[i], i);
fn.call(ctx, views[i], i);
}
};

Expand Down
3 changes: 1 addition & 2 deletions src/ui/ViewPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@ exports = Class(function () {
*/
this.forEachActiveView = function(fn, ctx) {
var views = this._views;
var f = bind(ctx, fn);
for (var i = this._freshViewIndex - 1; i >= 0; i--) {
f(views[i], i);
fn.call(ctx, views[i], i);
}
};

Expand Down

0 comments on commit 3f02512

Please sign in to comment.