Skip to content
Snippets Groups Projects
Commit a52a890c authored by rswindell's avatar rswindell
Browse files

Part of solution to performance problems ftn-setup.js and xtrn-setup.js

where Display.prototype.__getUpdateList__ was taking > 1 second on an rPi3:
We need to avoid using Frame.clear() which invalidates the entire frame
and requires an update check of every cell (e.g. thousands in a typical
frame). So we're going to depend on Frame.cleartoeol() which needed its
own optimization to invalidate every cell of the current line even when
the cells were already blank (undefined). So only mark the cells for
update if they actually have data in them that is being cleared.

Also, the putmsg() method was taking on a CRLF to the output string when
word-wrap was enabled. So removing the trailing whitespace after word
wrap does its thing. If this breaks other scripts, then perhaps we need
to restore the original CRLF on the end of the word-wrapped string, but
*only* if there was a CRLF on the end of the original string to begin
with.
parent 3eb302fd
No related branches found
No related tags found
No related merge requests found
......@@ -952,13 +952,13 @@ Frame.prototype.cleartoeol = function(attr) {
return false;
for(var x=px;x<this.__properties__.data[py].length;x++) {
if(this.__properties__.data[py][x]) {
this.__properties__.data[py][x].ch = undefined;
if(this.__properties__.data[py][x].ch !== undefined) {
this.__properties__.data[py][x].ch = undefined;
this.__properties__.display.updateChar(this,x - this.__position__.offset.x, this.__position__.cursor.y);
}
this.__properties__.data[py][x].attr = attr;
}
}
for(var x=this.__position__.cursor.x;x<this.width;x++) {
this.__properties__.display.updateChar(this,x,this.__position__.cursor.y);
}
}
Frame.prototype.crlf = function() {
this.__position__.cursor.x = 0;
......@@ -991,7 +991,7 @@ Frame.prototype.putmsg = function(str,attr) {
var remainingWidth = this.width - this.__position__.cursor.x;
if(str.length > remainingWidth) {
str = word_wrap(str,remainingWidth,str.length,false).split('\n');
str = str.shift() + '\r\n' + word_wrap(str.join('\r\n'),this.width,remainingWidth,false);
str = str.shift() + '\r\n' + word_wrap(str.join('\r\n'),this.width,remainingWidth,false).trimRight();
}
}
str = str.toString().split('');
......@@ -1565,6 +1565,7 @@ Display.prototype.__updateChar__ = function(x,y/*,data*/) {
this.__properties__.update[y] = {};
this.__properties__.update[y][x] = 1; /*data; */
}
Display.prototype.__getUpdateList__ = function() {
var list = [];
for(var y in this.__properties__.update) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment