From 3f02512b7f86490901da21d555756276ffbee7a2 Mon Sep 17 00:00:00 2001 From: Jimmy Griffith Date: Mon, 17 Nov 2014 17:05:36 -0800 Subject: [PATCH] call is faster than binding the function in forEach --- src/ui/ParticleEngine.js | 3 +-- src/ui/ViewPool.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ui/ParticleEngine.js b/src/ui/ParticleEngine.js index c67f2ab4..c8589842 100644 --- a/src/ui/ParticleEngine.js +++ b/src/ui/ParticleEngine.js @@ -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); } }; diff --git a/src/ui/ViewPool.js b/src/ui/ViewPool.js index 5603ef50..2a0feff2 100644 --- a/src/ui/ViewPool.js +++ b/src/ui/ViewPool.js @@ -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); } };