0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-26 13:49:01 -05:00

optimised Pairs.removeOld

This commit is contained in:
liabru 2021-04-26 23:54:48 +01:00
parent 1073ddeecf
commit a882a74cd5

View file

@ -111,6 +111,7 @@ var Common = require('../core/Common');
var pairsList = pairs.list, var pairsList = pairs.list,
pairsTable = pairs.table, pairsTable = pairs.table,
indexesToRemove = [], indexesToRemove = [],
pairMaxIdleLife = Pairs._pairMaxIdleLife,
pair, pair,
collision, collision,
pairIndex, pairIndex,
@ -127,7 +128,7 @@ var Common = require('../core/Common');
} }
// if pair is inactive for too long, mark it to be removed // 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); indexesToRemove.push(i);
} }
} }