Improve the performance of the timer utilitiy so that it does not garbage collect multiple times per frame.
This commit is contained in:
1 parent
4b777d94e4
commit
325372233d
1 file changed
+5
-3
@@ -21,6 +21,10 @@ class BlockUtility {
|
||||
* @type {?Thread}
|
||||
*/
|
||||
this.thread = thread;
|
||||
|
||||
this._nowObj = {
|
||||
now: () => this.runtime.currentMSecs
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,9 +50,7 @@ class BlockUtility {
|
||||
*/
|
||||
get nowObj () {
|
||||
if (this.runtime) {
|
||||
return {
|
||||
now: () => this.runtime.currentMSecs
|
||||
};
|
||||
return this._nowObj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user