From 325372233d1f15d8ee417b2da2cae1fe23e2ed6d Mon Sep 17 00:00:00 2001 From: Karishma Chadha Date: Wed, 16 Jan 2019 10:09:19 -0500 Subject: [PATCH 1/2] Improve the performance of the timer utilitiy so that it does not garbage collect multiple times per frame. --- src/engine/block-utility.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/engine/block-utility.js b/src/engine/block-utility.js index 5aa79f72..15079dbc 100644 --- a/src/engine/block-utility.js +++ b/src/engine/block-utility.js @@ -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; } From 7588f08f3bfd9364baa126c5f87561bae6c3a2ca Mon Sep 17 00:00:00 2001 From: Karishma Chadha Date: Wed, 23 Jan 2019 11:33:36 -0500 Subject: [PATCH 2/2] Use sequencer runtime directly instead of doing an extra lookup --- src/engine/block-utility.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/block-utility.js b/src/engine/block-utility.js index 15079dbc..f09d6eec 100644 --- a/src/engine/block-utility.js +++ b/src/engine/block-utility.js @@ -23,7 +23,7 @@ class BlockUtility { this.thread = thread; this._nowObj = { - now: () => this.runtime.currentMSecs + now: () => this.sequencer.runtime.currentMSecs }; }