perf: flat tickers
This commit is contained in:
parent
4d18430260
commit
4bece84a47
|
@ -16,7 +16,7 @@ export function Synchronized(Superclass) {
|
|||
this.state = I.Map();
|
||||
this._childrenWithState = []
|
||||
this._childrenWithoutState = [];
|
||||
this._childrenWithTickers = [];
|
||||
this._childrenTickers = [];
|
||||
}
|
||||
|
||||
initializeSynchronizedChildren() {
|
||||
|
@ -27,7 +27,7 @@ export function Synchronized(Superclass) {
|
|||
'undefined' !== typeof this[key]
|
||||
&& 'undefined' !== typeof this[key].tick
|
||||
) {
|
||||
this._childrenWithTickers.push(key);
|
||||
this._childrenTickers.push(this[key].tick.bind(this[key]));
|
||||
}
|
||||
if (
|
||||
'undefined' !== typeof this[key]
|
||||
|
@ -84,9 +84,8 @@ export function Synchronized(Superclass) {
|
|||
}
|
||||
|
||||
tick(elapsed) {
|
||||
for (let i = 0; i < this._childrenWithTickers.length; ++i) {
|
||||
const key = this._childrenWithTickers[i];
|
||||
this[key].tick(elapsed);
|
||||
for (let i = 0; i < this._childrenTickers.length; ++i) {
|
||||
this._childrenTickers[i](elapsed);
|
||||
}
|
||||
if (AVOCADO_SERVER) {
|
||||
this.tickMutateState();
|
||||
|
|
Loading…
Reference in New Issue
Block a user