Merge pull request from mzgoddard/unwrapped

execute optimization by unwrapping recursion
This commit is contained in:
Ray Schamp 2018-07-02 11:20:01 -04:00 committed by GitHub
commit 4525139d59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 233 additions and 194 deletions
src/engine

View file

@ -35,6 +35,7 @@ class Blocks {
* @type {{inputs: {}, procedureParamNames: {}, procedureDefinitions: {}}}
* @private
*/
Object.defineProperty(this, '_cache', {writable: true, enumerable: false});
this._cache = {
/**
* Cache block inputs by block id
@ -1032,6 +1033,7 @@ BlocksExecuteCache.getCached = function (blocks, blockId, CacheType) {
if (typeof CacheType === 'undefined') {
cached = {
id: blockId,
opcode: blocks.getOpcode(block),
fields: blocks.getFields(block),
inputs: blocks.getInputs(block),
@ -1039,6 +1041,7 @@ BlocksExecuteCache.getCached = function (blocks, blockId, CacheType) {
};
} else {
cached = new CacheType(blocks, {
id: blockId,
opcode: blocks.getOpcode(block),
fields: blocks.getFields(block),
inputs: blocks.getInputs(block),