xP: avoid expensive updates/refreshes
This commit is contained in:
parent
69eccc7065
commit
ef257cd575
|
@ -286,7 +286,6 @@ rpcEventHandlers.set(Relay.Event.BufferLine, e => {
|
||||||
// Initial sync: skip all other processing, let highlights be.
|
// Initial sync: skip all other processing, let highlights be.
|
||||||
if (bufferCurrent === undefined) {
|
if (bufferCurrent === undefined) {
|
||||||
b.lines.push(line)
|
b.lines.push(line)
|
||||||
bufferPopExcessLines(b)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,6 +301,12 @@ rpcEventHandlers.set(Relay.Event.BufferLine, e => {
|
||||||
else
|
else
|
||||||
b.newMessages++
|
b.newMessages++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX: In its unkeyed diff algorithm, Mithril.js can only efficiently
|
||||||
|
// deal with common prefixes, i.e., indefinitely growing buffers.
|
||||||
|
// But we don't want to key all children of Buffer,
|
||||||
|
// so only trim buffers while they are, or once they become invisible.
|
||||||
|
if (e.bufferName != bufferCurrent)
|
||||||
bufferPopExcessLines(b)
|
bufferPopExcessLines(b)
|
||||||
|
|
||||||
if (e.leakToActive) {
|
if (e.leakToActive) {
|
||||||
|
@ -313,7 +318,6 @@ rpcEventHandlers.set(Relay.Event.BufferLine, e => {
|
||||||
else
|
else
|
||||||
bc.newMessages++
|
bc.newMessages++
|
||||||
}
|
}
|
||||||
bufferPopExcessLines(bc)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.isHighlight || (!visible && !line.isUnimportant &&
|
if (line.isHighlight || (!visible && !line.isUnimportant &&
|
||||||
|
@ -370,8 +374,16 @@ rpcEventHandlers.set(Relay.Event.BufferRemove, e => {
|
||||||
|
|
||||||
rpcEventHandlers.set(Relay.Event.BufferActivate, e => {
|
rpcEventHandlers.set(Relay.Event.BufferActivate, e => {
|
||||||
let old = buffers.get(bufferCurrent)
|
let old = buffers.get(bufferCurrent)
|
||||||
if (old !== undefined)
|
if (old !== undefined) {
|
||||||
bufferResetStats(old)
|
bufferResetStats(old)
|
||||||
|
bufferPopExcessLines(old)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initial sync: trim all buffers to our limit, just for consistency.
|
||||||
|
if (bufferCurrent === undefined) {
|
||||||
|
for (let b of buffers.values())
|
||||||
|
bufferPopExcessLines(b)
|
||||||
|
}
|
||||||
|
|
||||||
bufferLast = bufferCurrent
|
bufferLast = bufferCurrent
|
||||||
let b = buffers.get(e.bufferName)
|
let b = buffers.get(e.bufferName)
|
||||||
|
|
Loading…
Reference in New Issue