-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove inner setTimeout(), prevents high CPU usage. #1447
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1290,7 +1290,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II | |
// Kick off a write which will write all data in sequence recursively | ||
this._writeInProgress = true; | ||
// Kick off an async innerWrite so more writes can come in while processing data | ||
setTimeout(() => { | ||
requestAnimationFrame(() => { | ||
this._innerWrite(); | ||
}); | ||
} | ||
|
@@ -1324,7 +1324,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II | |
} | ||
if (this.writeBuffer.length > 0) { | ||
// Allow renderer to catch up before processing the next batch | ||
setTimeout(() => this._innerWrite(), 0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This timeout allows the renderer to catch up, without it there may not be a draw for some time. ie. the frame rate can drop significantly There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes this change basically reduces screen updates by 90%, now I can count the updates for my typical benchmark with |
||
this._innerWrite(); | ||
} else { | ||
this._writeInProgress = false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could delay parsing by 1+ frames. We could maybe just remove this timeout instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cant be removed as it is now, it gives the renderer time to do anything atm. (Removing it will completely disable updates while a command is running, which is reallly fast but prolly not wanted, lol).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the timeout that starts a batch, would considering a batch immediately be no good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my tests with
ls -lR /usr/lib
andfind /
the emulator went silent for a couple of seconds and updated the screen once in a while (like every 3s, forls
it was black until the command had finished). I did not step debug this, seems the updates are way behind without the timeout here.