xterm.js: initTable is slow, can we lazily load parts as they're needed?
On my fairly fast gaming desktop it’s over a frame:
It looks like initTable
could be made so only load chunks of table
as necessary, splitting it into 32 parts (66636/32=2048 codepoints) would probably make it have minimal impact on frames following a load.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 29 (29 by maintainers)
@skprabhanjan Another approach - programmatically walk the 0 and 2 width codepoints to fill the table. Instead of repeatingly doing the bisect and
isWideBMP
eval for every single codepoint from 0 to 65536 we can simply create the lookup table cheaper by this:This lowers the creation cost down to 1.5 ms for the whole table and can be done during lib initialization. This coupled with the slightly more expensive 64k table and we have really nice speedup at initialization and during runtime. 😸
@Tyriar Mission accomplished?
Edit: With
.subarray
instead of the loops the above table creation runs in 0.2 ms, lol.