Skip to content

Commit

Permalink
optimised Pairs.removeOld
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Apr 29, 2021
1 parent 1073dde commit a882a74
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/collision/Pairs.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ var Common = require('../core/Common');
var pairsList = pairs.list,
pairsTable = pairs.table,
indexesToRemove = [],
pairMaxIdleLife = Pairs._pairMaxIdleLife,
pair,
collision,
pairIndex,
Expand All @@ -127,7 +128,7 @@ var Common = require('../core/Common');
}

// if pair is inactive for too long, mark it to be removed
if (timestamp - pair.timeUpdated > Pairs._pairMaxIdleLife) {
if (timestamp - pair.timeUpdated > pairMaxIdleLife) {
indexesToRemove.push(i);
}
}
Expand Down

0 comments on commit a882a74

Please sign in to comment.