Minor change to enable a V8 optimization

This commit is contained in:
Florian Rival
2015-04-27 21:34:35 +12:00
parent 752d2a48cf
commit eea57cc65f
2 changed files with 4 additions and 5 deletions

View File

@@ -449,7 +449,7 @@ gdjs.RuntimeGame.prototype.startStandardGameLoop = function() {
currentScene.loadFromScene(firstsceneData);
//Uncomment to profile the first x frames of the game.
/*var x = 500;
/*var x = 250;
console.profile("Stepping for " + x + " frames")
for(var i = 0; i < x; ++i) {
currentScene.renderAndStep();

View File

@@ -314,8 +314,7 @@ gdjs.RuntimeScene.prototype._updateObjectsPreEvents = function() {
gdjs.RuntimeScene.prototype._updateObjects = function() {
this._cacheOrClearRemovedInstances();
var allObjectsLists = this._instances.entries();
this.updateObjectsForces(allObjectsLists);
this.updateObjectsForces();
//It is *mandatory* to create and iterate on a external list of all objects, as the automatisms
//may delete the objects.
@@ -348,8 +347,8 @@ gdjs.RuntimeScene.prototype.getName = function() {
* Update the objects positions according to their forces
* @method updateObjectsForces
*/
gdjs.RuntimeScene.prototype.updateObjectsForces = function(objects) {
var allObjectsLists = objects ? objects : this._instances.entries();
gdjs.RuntimeScene.prototype.updateObjectsForces = function() {
var allObjectsLists = this._instances.entries();
for( var i = 0, len = allObjectsLists.length;i<len;++i) {
for( var j = 0, listLen = allObjectsLists[i][1].length;j<listLen;++j) {