I am working on a terminal emulator for entertainment and support the basics of the backend. However, I continue to run into performance issues on the interface.
As you probably know, each character in the terminal window can have a different style. (color, background, bold, underline, etc.). So my idea was to use a <span> for each character in the viewport and apply the inline style if necessary, so I have the degree of control I need.
The problem is that performance is terrifying when upgrading. Chrome can process it on my computer with about 120 operating systems per second, and firefox with 80. But the Internet explorer barely gets 6. So after my stay in html I tried to use the canvas, but the text on the canvas is very slow. The Internet that I read caches, so I implement a cache for each character and can apply colors to the then bitmap font with some kind of composite operation. However, this path is slower than the DOM.
Then I went back to dom and tried to use document.createDocumentFragment , but it is a little worse than the standard just used.
I donβt know where to start optimization now. I could follow that the character is changing, but then I still encounter this slowness when the terminal receives a lot of input.
I am new to the DOM, so I can do something completely wrong ...
any help is appreciated!
Here is jsperf with several test windows:
http://jsperf.com/canvas-bitma32p-cache-test/6
optimization javascript dom html
John smith
source share