Improve the performance of the timer utilitiy so that it does not garbage collect multiple times per frame.

This commit is contained in:
Karishma Chadha 2019-01-16 10:09:19 -05:00
parent 4b777d94e4
commit 325372233d

View file

@ -21,6 +21,10 @@ class BlockUtility {
* @type {?Thread} * @type {?Thread}
*/ */
this.thread = thread; this.thread = thread;
this._nowObj = {
now: () => this.runtime.currentMSecs
};
} }
/** /**
@ -46,9 +50,7 @@ class BlockUtility {
*/ */
get nowObj () { get nowObj () {
if (this.runtime) { if (this.runtime) {
return { return this._nowObj;
now: () => this.runtime.currentMSecs
};
} }
return null; return null;
} }