From 4f8158e579a7092fcfbf8efc944f6608d85f70b6 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 15 Apr 2021 13:49:17 -0300 Subject: don't use makeNode (cur: 84k/sec) This actually might 8e 85k/sec 8ut that feels, uh, counter-intutive? Pretty sure it was just getting optimized out, anyway. --- upd8.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/upd8.js b/upd8.js index eec04d7..9e2ed2e 100755 --- a/upd8.js +++ b/upd8.js @@ -979,8 +979,7 @@ const replacerSpec = { const tagArgumentValue = '='; const tagLabel = '|'; - const makeNode = (i, type, data) => ({i, type, data}); - const makeError = (i, message) => makeNode(i, 'error', {message}); + const makeError = (i, message) => ({i, type: 'error', data: {message}}); const endOfInput = (i, comment) => makeError(i, `Unexpected end of input (${comment}).`); // These are 8asically stored on the glo8al scope, which might seem odd @@ -1003,7 +1002,7 @@ const replacerSpec = { const pushTextNode = () => { if (string.length) { - nodes.push(makeNode(iString, 'text', string)); + nodes.push({i: iString, type: 'text', data: string}); string = ''; } }; @@ -1129,7 +1128,7 @@ const replacerSpec = { i = stop_iParse; } - nodes.push(makeNode(iTag, 'tag', {replacerKey, replacerValue, args, label})); + nodes.push({i: iTag, type: 'tag', data: {replacerKey, replacerValue, args, label}}); continue; } -- cgit 1.3.0-6-gf8a5