« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xindex.js22
-rw-r--r--stress-test.txt4
m---------tui-lib0
3 files changed, 26 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()
diff --git a/stress-test.txt b/stress-test.txt
new file mode 100644
index 0000000..bc4b2e8
--- /dev/null
+++ b/stress-test.txt
@@ -0,0 +1,4 @@
+# of times ran
+- With cached getCursorIndex(): 900
+- With (broken) less objects: ...still 900 [REMOVED]
+- With less attributes.slice(): 1000
diff --git a/tui-lib b/tui-lib
-Subproject 09e1daec696ac8cb41c45029d298135340fc6ed
+Subproject 754f834035271279b279a13514c8031069dc4f7