Skip to content
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

Editing first line causes full viewport re-render #1623

Closed
princjef opened this issue Aug 22, 2018 · 0 comments
Closed

Editing first line causes full viewport re-render #1623

princjef opened this issue Aug 22, 2018 · 0 comments
Labels
area/performance type/bug Something is misbehaving
Milestone

Comments

@princjef
Copy link
Contributor

Type Version
OS Windows 10
Browser Electron 2.0.7
Xterm 3.6.0

While verifying the fix for #1620, I noticed things were still on the slower side, but this time only when i was typing on the first line of the terminal. Sorry for piling on with another one of these 😞

Same general process as before:

  1. Ran the xterm-electron-sample project
  2. Made the window full screen (1080p screen in my case) and clear the output with Ctrl+L to make sure my input is on the first line.
  3. Opened the dev tools (Ctrl+Shift+I) and started a profiling session
  4. Started typing random ascii characters on the shell prompt and recorded the render times for each keystroke.

Looks like this one is caused by this (specifically the second line):

rowStart = rowStart || 0;
rowEnd = rowEnd || this._terminal.rows - 1;

I had initially thought this one was fine because I had been remembering that the end line was exclusive, not inclusive. However, this is not the case, so when editing the first line and only the first line, rowEnd || this._terminal.rows - 1 evaulates to this._terminal.rows - 1 because rowEnd is falsy, triggering a full viewport refresh.

I've verified that tightening up the check fixes the slowdown for this case. Will send a PR shortly.

As a side note, I was surprised by the amount of time spent rendering the blank lines at the bottom of my terminal. This may be specific to the configuration of my normal setup (there's some transparency which results in compositing of the layers), but if it's not being done already, it might be worth trying to bypass foreground drawing for space characters altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/performance type/bug Something is misbehaving
Projects
None yet
Development

No branches or pull requests

2 participants