perf: flatten pfu
This commit is contained in:
parent
29abc9f540
commit
f3273648b6
|
@ -6,6 +6,9 @@ export class Synchronizer {
|
|||
|
||||
constructor(children) {
|
||||
this.children = children;
|
||||
this.childrenPacketsForUpdate = this.children.map((child) => {
|
||||
return child.packetsForUpdate.bind(child);
|
||||
});
|
||||
}
|
||||
|
||||
acceptPacket(packet) {
|
||||
|
@ -16,8 +19,8 @@ export class Synchronizer {
|
|||
|
||||
packetsForUpdate(force = false) {
|
||||
const packetsForUpdate = [];
|
||||
for (let i = 0; i < this.children.length; i++) {
|
||||
const childPacketsForUpdate = this.children[i].packetsForUpdate(force);
|
||||
for (let i = 0; i < this.childrenPacketsForUpdate.length; i++) {
|
||||
const childPacketsForUpdate = this.childrenPacketsForUpdate[i](force);
|
||||
for (let j = 0; j < childPacketsForUpdate.length; j++) {
|
||||
packetsForUpdate.push(childPacketsForUpdate[j]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user