« get me outta code hell

Stress test stuff - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/index.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-12-04 23:16:00 -0400
committerFlorrie <towerofnix@gmail.com>2018-12-04 23:16:00 -0400
commite3e2907b2f9b43b2afaa12d227a5534fc50eb2f4 (patch)
treedc03657dcf9f62a9391fffb822b7124680df6669 /index.js
parenta928d7de2780afc82ea25ed7dffdf203e13dc3a5 (diff)
Stress test stuff
Just to see if I can optimize tui-lib's ansi diffing.
Diffstat (limited to 'index.js')
-rwxr-xr-xindex.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/index.js b/index.js
index 9682e95..d6dbcee 100755
--- a/index.js
+++ b/index.js
@@ -80,6 +80,28 @@ async function main() {
     root.fixAllLayout()
   })
 
+  if (process.argv.includes('--stress-test')) {
+    const w = 80
+    const h = 40
+    flushable.resizeScreen({lines: w, cols: h})
+    root.w = w
+    root.h = h
+    root.fixAllLayout()
+    const start = Date.now()
+    let n = 0
+    while (Date.now() < start + 1000) {
+      root.renderTo(flushable)
+      flushable.flush()
+      n++
+    }
+
+    console.log(ansi.clearScreen() + ansi.cleanCursor())
+    console.log('# of times ran:', n)
+    process.exit(0)
+
+    return
+  }
+
   setInterval(() => {
     root.renderTo(flushable)
     flushable.flush()