-
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
Startup and canvas render window resize that updates devicePixelRatio is expensive #955
Comments
The best solution to these two issues is to pull the CharAtlas generation into a web worker. This is blocked on OffscreenCanvas support so that we can draw on a worker thread. The great thing about this solution is that the terminal can start drawing immediately just fine, the CharAtlas is just an optimization that can come in whenever and it will be picked up and used from that point on,. |
Sounds good to me. Just one question. From what I understand, the CharAtlas needs to be generated every time the zoom factor changes. If this is true, is the web worker going to be an one-off process or something like a daemon waiting to be requested to generate a new CharAtlas? I think an one-off process would introduce less memory overhead overall. |
One off process is what I'm thinking as it's generally a pretty infrequent thing. If they take a little while to spin up then we could add some time after it's stopped before terminating? (eg. ctrl++ multiple times) |
Great catch. 👍 |
This doesn't actually add workers but it separates the code nicely such that the minimal amount of relevant code can be pulled in by worker code. Part of xtermjs#955
There's an example of generating the char atlas using a web worker at https://github.com/Tyriar/xterm.js/tree/955_worker. I'll probably leave it there for now and wait for Electron to get a version out that supports |
Nice! You can use win = new BrowserWindow({
width: 1200,
height: 700,
webPreferences: { experimentalCanvasFeatures: true }
}) |
Not sure it would be wise to jump in that early though, there would be a lot of these blocked bugs in Chromium v59 https://bugs.chromium.org/p/chromium/issues/detail?id=563816 |
Seeing that list of open issues I agree it would be wise to wait until it becomes official 😅 |
I've seen reports of some of the initial frame draws to the terminal taking 3+ seconds, one way to help this could be to move the atlas stuff out to a worker. That way instead of a new uncached draw doing a draw to both the canvas and the atlas, it would just do the canvas and then request to atlas worker to cache the new char. |
No plans to implement this for canvas renderer as we'll move towards the webgl addon that was just moved eventually |
After #938
Repro:
The reason this happens is because it redraws the char atlas, that's also the reason the time gets greater the more cmd/ctrl + is pressed (more pixels). This could be done using
OffscreenCanvas
and web workers for browsers that support?The text was updated successfully, but these errors were encountered: