« get me outta code hell

don't use makeNode (cur: 84k/sec) - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-04-15 13:49:17 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-04-15 13:49:17 -0300
commit4f8158e579a7092fcfbf8efc944f6608d85f70b6 (patch)
treeed95983c108cbd6ac1d958fea13ef9f671dd32be
parentaaef4b0ca3b1432101d1ca84cc7b4898ddee7789 (diff)
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.
-rwxr-xr-xupd8.js7
1 files 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;
             }