« get me outta code hell

run 5s of tests instead of 1 (cur: 87k/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:51:19 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-04-15 13:51:19 -0300
commit396491ffd6f4428f72e749057da78bf042bf36b7 (patch)
tree1b21fecbe35511d7ad824238be42ae454335e42b
parente5681aa48b464fc194b4445670e7bf027f314562 (diff)
run 5s of tests instead of 1 (cur: 87k/sec)
Why does this improve efficiency? I do not know.

It's entirely possi8le the earlier estim8tions were just off, and this
is more accur8te.
-rwxr-xr-xupd8.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/upd8.js b/upd8.js
index 4555b004..7396ac3b 100755
--- a/upd8.js
+++ b/upd8.js
@@ -1175,13 +1175,14 @@ const replacerSpec = {
 {
     function test(input) {
         let n = 0;
+        const s = 5;
         const start = Date.now();
-        const end = start + 1000;
+        const end = start + s * 1000;
         while (Date.now() < end) {
             transformInline.parse(input);
             n++;
         }
-        console.log(`Ran ${n} times.`);
+        console.log(`Ran ${Math.round(n / s)} times/sec.`);
     }
 
     test(fixWS`