perf: use raw iterator
This commit is contained in:
parent
e3a76de12b
commit
7b292070e1
|
@ -37,11 +37,17 @@ export class AbstractWorld extends decorate(class {}) {
|
|||
}
|
||||
|
||||
tick(elapsed) {
|
||||
this.tickPhysics(elapsed);
|
||||
}
|
||||
|
||||
tickPhysics(elapsed) {
|
||||
// Propagate position updates.
|
||||
for (let i = 0; i < this.entitiesList.length; ++i) {
|
||||
const entity = this.entitiesList[i];
|
||||
const it = this.entities.entries();
|
||||
for (let value = it.next(); value.done !== true; value = it.next()) {
|
||||
const body = value.value[0];
|
||||
const entity = value.value[1];
|
||||
const entityPosition = entity.position;
|
||||
const bodyPosition = entity.body.position;
|
||||
const bodyPosition = body.position;
|
||||
// Hot.
|
||||
if (
|
||||
(entityPosition[0] << 0) === (bodyPosition[0] << 0)
|
||||
|
@ -49,7 +55,7 @@ export class AbstractWorld extends decorate(class {}) {
|
|||
) {
|
||||
continue;
|
||||
}
|
||||
entity.setPosition(entity.body.position);
|
||||
entity.setPosition(body.position);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user