From e076672f8293a381a6cdda03a38518f0182e6845 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Fri, 10 Nov 2017 01:19:15 +0000 Subject: [PATCH] speed up terminal rendering --- www/res/terminal.js | 74 ++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/www/res/terminal.js b/www/res/terminal.js index d742699..f49df38 100644 --- a/www/res/terminal.js +++ b/www/res/terminal.js @@ -7,7 +7,7 @@ HTMLCollection.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; function Terminal(target, bps) { - bps = bps || 1200; + bps = bps || 9600; var outq = []; var outTimer; @@ -18,42 +18,42 @@ function Terminal(target, bps) { // So now it leaves the scrollbar in place, and the user has to scroll. // This is how the Plan 9 terminal (1991) works. function tx(pairs, bps, scroll) { - var drawTimer; + var drawTimer; + + // Looks like EMCAScript 6 has a yield statement. + // That would make this mess a lot easier to understand. + + var pairIndex = 0; + var pair = pairs[0]; + + var textIndex = 0; + var text = ""; + + function draw() { + var node = pair[0]; + var src = pair[1]; + var c = src[textIndex]; + + text += c; + node.textContent = text; + + textIndex += 1; + if (textIndex == src.length) { + textIndex = 0; + text = ""; + + pairIndex += 1; + if (pairIndex == pairs.length) { + clearInterval(drawTimer); + return; + } + pair = pairs[pairIndex]; + } - // Looks like EMCAScript 6 has a yield statement. - // That would make this mess a lot easier to understand. - - var pairIndex = 0; - var pair = pairs[0]; - - var textIndex = 0; - var text = ""; - - function draw() { - var node = pair[0]; - var src = pair[1]; - var c = src[textIndex]; - - text += c; - node.textContent = text; - - textIndex += 1; - if (textIndex == src.length) { - textIndex = 0; - text = ""; - - pairIndex += 1; - if (pairIndex == pairs.length) { - clearInterval(drawTimer); - return; - } - pair = pairs[pairIndex]; - } - - if (scroll) { - node.scrollIntoView(); - } - } + if (scroll) { + node.scrollIntoView(); + } + } // N81 uses 1 stop bit, and 1 parity bit. // That works out to exactly 10 bits per byte. @@ -66,7 +66,7 @@ function Terminal(target, bps) { function start() { if (! outTimer) { - outTimer = setInterval(drawElement, 75); + outTimer = setInterval(drawElement, 25); } }