-
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
Render performance degradation from 3.0.2 to 3.7.0 #1677
Comments
I don't think this is anything to worry about, some history:
Let me know if that doesn't sound right for what you're seeing. A devtools perf profile would help better identify what's going on if not. |
@Tyriar This is still an issue to me, please keep it open, thanks. I've updated the repro steps.
Do you have any issue tracking this? |
@tsl0922 I'm having trouble finding it. Can you provide a chrome perf timeline to show the difference you're seeing? |
@Tyriar Uploaded profile data (tested with an old macbook air, the FPS is even worse): |
@tsl0922 which OS, browser (including versions) were both of these profiles running on? |
@Tyriar macOS High Sierra 10.13.6/ Chrome 69.0.3497.81 |
@tsl0922 and this is xterm 3.0.2 vs 3.7.0? Can you also do the same against 3.4? 3.4 should have the line fix but not the dynamic cache parts. |
@Tyriar yes its xterm 3.0.2 vs 3.7.0. 3.4.0 still have this issue as 3.7.0, but 3.3.0 works good, so I've downgraded xterm to 3.3.0 in ttyd now and the reporter confirmed this fixes the issue(tsl0922/ttyd#126 (comment)). |
Hm, well 3.4.0 is when the dynamic cache was introduced which touched a lot of stuff #1327 |
@tsl0922 yeah I think you're on to something, on my macbook I'm seeing approx the following numbers:
After a look at the code it may just be the additional of the abstractions/functions/GC 🤔. I certainly don't expect the numbers to have degraded that much. |
The profile shows like >90% of the runtime is spend in @tsl0922 Does your input contain lots of different chars that are not in the ASCII range? Tbh both profiles look not so good regarding drawing to total runtime ratio. Could you check chrome://gpu if the browser is using hardware acceleration at all? |
@jerch This issue can be reproduced with vim too: just open source file with syntax highlighting and press j to scroll. |
@jerch did you switch to dynamic cache? I'm trying to narrow down what's going on and I'm eyeing these lines atm: String generated every char draw:
Object created every char draw: xterm.js/src/renderer/BaseRenderLayer.ts Line 250 in 74474da
|
I'm also seeing the static atlas on the master branch drawing rows around 30% faster which I would largely put up to the string creation. |
@Tyriar |
@Tyriar Could the cache key string be replaced by some integer? A template string creation vs. an integer on every char should make some difference. |
@jerch yeah I think could probably pack an integer with all that data (ascii+256 color). I still don't get why the drawImage calls seem to cost so much more in the later version 😕 Perhaps because it's drawing from a canvas now and not a bitmap? |
I think I fixed it, I removed a bunch of the object/string overhead and drawing from an ImageBitmap seems to make the dynamic cache go down to around 3ms on average (from 7). PR probably tomorrow. |
Wow nice 👍 Also chrome got much much better in drawing things to canvas since version >65, the difference here between electron v2 and the newer browser is really impressive (like 3-5x faster in my tests). Maybe its broken again with v69 (not yet tested, still v68 here)? |
Update: This issue should be introduced between 3.3.0 and 3.4.0.
Originally reported at: tsl0922/ttyd#126
Details
Steps to reproduce
vtop
(npm install -g vtop
).It's much smoother on 3.0.2 (ttyd 1.4.0) than 3.7.0 (ttyd 1.4.1).
The text was updated successfully, but these errors were encountered: