-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Refresh limit system makes performance bad on Windows #280
Comments
This may be not totally related but do you think the refresh frequency could be dynamic ? Because I think it would be better for the user experience to have a default 60 fps refresh rate. The terminal will probably feel more responsive. |
@codec-abc 60fps is unrealistic for high output programs. High output means many changes of the DOM which increases the penalty for the reflow. Sticking to 60fps would therefore slow down the output flow. It might be a goal though if the stream parsing and state handling would have their own thread. @Tyriar I suggest to bind the refresh to an animation frame to avoid cancelled reflows: |
@Tyriar I think this due to the fact that I append a small patch which reduces diff --git a/src/Viewport.js b/src/Viewport.js
index d23ba7c..df87799 100644
--- a/src/Viewport.js
+++ b/src/Viewport.js
@@ -16,6 +16,8 @@ function Viewport(terminal, viewportElement, scrollArea, charMeasureElement) {
this.viewportElement = viewportElement;
this.scrollArea = scrollArea;
this.charMeasureElement = charMeasureElement;
+ this.charSize = this.charMeasureElement.getBoundingClientRect();
+ this.scrollPending = false;
this.currentRowHeight = 0;
this.lastRecordedBufferLength = 0;
this.lastRecordedViewportHeight = 0;
@@ -34,7 +36,7 @@ function Viewport(terminal, viewportElement, scrollArea, charMeasureElement) {
* doesn't exist it will be created.
*/
Viewport.prototype.refresh = function(charSize) {
- var size = charSize || this.charMeasureElement.getBoundingClientRect();
+ var size = charSize || this.charSize;
if (size.height > 0) {
var rowHeightChanged = size.height !== this.currentRowHeight;
if (rowHeightChanged) {
@@ -78,9 +80,15 @@ Viewport.prototype.syncScrollArea = function() {
}
// Sync scrollTop
- var scrollTop = this.terminal.ydisp * this.currentRowHeight;
- if (this.viewportElement.scrollTop !== scrollTop) {
- this.viewportElement.scrollTop = scrollTop;
+ var self = this;
+ if (!this.scrollPending) {
+ this.scrollPending = true;
+ requestAnimationFrame(function(){
+ // hack - simply scroll to bottom assuming container
+ // is never higher than the hardcoded value
+ self.viewportElement.scrollTop = 3000000000;
+ self.scrollPending = false;
+ });
}
}; Just tested it in VSCode 1.5.3 under Windows - it will not work there without a few changes (for some reasons the metrics of |
This is very obvious when you compare xterm.js within vscode to hyper, it helps that their scroll bar seems to be only for show though (no need to deal with |
Stating the obvious: I think we should tear down the whole rendering part and reduce as much waste as possible for start. I am not sure if I can get on top of this right now, but I can definitely help if you are willing to take this over @Tyriar. |
I'd still like to do it when I get a chance, the |
Use requestAnimationFrame in addition to a queue to refresh every animation frame but only when a refresh is needed. Fixes xtermjs#280
Use requestAnimationFrame in addition to a queue to refresh every animation frame but only when a refresh is needed. Fixes xtermjs#280 Fixes xtermjs#290
The integrated terminal in VS Code has a performance issue on Windows outlined here microsoft/vscode#10328 (comment), @codec-abc suggests it's due to the limit system in the refresh function:
Details
The text was updated successfully, but these errors were encountered: