-
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
Consider changing null cell data to all zeros #4139
Comments
Well back then the idea for making the While thinking about #4115 I found another intriguing refactoring idea, which promises some speedup esp. during
I think any mass action on the buffer working similar like that would benefit from it, as we dont have to do the |
@jerch that memory layout would be better for fill, but worse for reusing the content on resize which is currently one of the more problematic areas |
Ah right, this would need move semantics on the FG and BG part, which is def. much worse compared to just truncating or filling with zeros. I also did a quick About the filling issue above - just checked the bit fields, imho it is safe to just fill NULL_CELLS from its CONTENT even for FG and BG, as the width maps into RGB section, which never gets evaled if CM_MASK is not set in a NULL_CELL (which is currently the case). So we can just do |
@jerch am I reading that right that we can safely male that change, with a warning about width not being accurate if it's |
Ah well I meant it this way - if we just fill all excess uint32 slots from current NULL_CELL.CONTENT value it should just work, because it will just contain (1<<22) in all slots, thus also for FG and BG, where it is technically wrong. But it is not harmful, as the FG/BG value dont eval the lower 3 bytes (RGB section, thus bit 1..24) since In summary we'd only need to do:
|
I understand now, it would get the job done but does indeed feel hacky. The optimization probably isn't worth the added complexity 🤔 |
Yeah - that summarizes it pretty well, sadly. And putting such a hack in place is dangerous, in several months no ones remembers exactly it was all about and boom 🙈 |
On resize when the cols in the terminal increases, we fill in cell data at the end of the buffer here:
xterm.js/src/common/buffer/BufferLine.ts
Line 353 in 1431210
This is doing a relatively large amount of work as each individual index of the cell needs to be set directly off the cell object:
xterm.js/src/common/buffer/BufferLine.ts
Lines 218 to 220 in 1431210
If we made "null cell data" all zeroes, we could then use a single typed array fill call, at least when the fill data is all default background and foreground colors which is the typical case.
This would involve either adapting the code so null cells have a width of 0 instead of 1, or change a cell's width=1 to actually be encoded as
0 << Conten.WIDTH_SHIFT
:xterm.js/src/common/buffer/CellData.ts
Line 83 in 1431210
The text was updated successfully, but these errors were encountered: