Startup and canvas render window resize that updates devicePixelRatio is expensive
See original GitHub issueAfter https://github.com/sourcelair/xterm.js/pull/938
Repro:
- Launch xterm.js
- Open demo
- Start performance timeline
- Press cmd/ctrl and + 3 times
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?
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Scale Pixels for the Canvas with devicePixelRatio in React
[00:26] The key to this working is to get the ratio between the number of hardware pixels to software pixels, from window.devicePixelRatio. You' ......
Read more >Scaling performance - React Three Fiber Documentation
This is a short primer on how to scale performance. Running WebGL can be quite expensive depending on how powerful your devices are....
Read more >WebGL best practices - Web APIs - MDN Web Docs - Mozilla
Avoid alpha:false, which can be expensive. Specifying alpha:false during context creation causes the browser to composite the WebGL-rendered ...
Read more >(Three.js) Bloom effect performance - javascript - Stack Overflow
This problem is causing you to render a full window sized canvas and effects ... The next issue is that blur/bloom is an...
Read more >PIXI.Application - PixiJS API Documentation
WebGL renderer if available, otherwise CanvasRenderer. resizeTo Window | HTMLElement. The HTML element or window to automatically resize the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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)
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,.