-
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
some buffer handling optimizations #4115
Conversation
Alternatively we can just not do this optimization for xterm-headless, adding it later on if/when |
About lazy resizing of the underlying array buffer - see #4144 @Tyriar I currently dont like the idea to place lines * |
@jerch 👍
I always think something will work for |
@Tyriar Yeah WeakMap and WeakSet are very awkward and mostly not of much use. Will see if its useful here (have currently benchmark issues, seems master has a bad perf issue, my typical |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tyriar Plz have a look at the way I use DebouncedIdleTask
on Buffer
. Resizing is quite fast that way (~120ms), furthermore it splits its memory alloc workload into smaller batches, that dont interfere too much with mainthread latency (its at ~13ms on my machine for 5k lines, can do smaller batches if needed). Also the batching should be resilient to in-between resizes altering bufferlines again before the memory got fully fixed (well, still needs some unit tests).
NB: I think there is still a catch in DebouncedIdleTask
, as I get Uncaught ReferenceError: performance is not defined
on nodejs. Is that unit tested to work on nodejs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about the delay, didn't realize this one was waiting on me 😅
@Tyriar Saw that you use [*] Observed the bad runtime of |
@Tyriar Ready for review. Note that I changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and lgtm!
@Tyriar Oh well - should we still change the rescan logic as described here?
Would be a more "heuristical" approach avoiding the bad exp rescan runtime for n scrollback lines ... |
If you think it's worth it, the PR is way better than the current state already 🙂 |
Holy cow, just tested it and what can I say - never underestimate the effect of exp growing, even for cheapo tasks like rescanning arrays in JS. Here are some numbers for 100k scrollback compared to before, with 100 (!) lines batched:
Outch, I'd say the result tells - nope, try to avoid exp runtime at any costs (well beside exp costs lol). 😅 |
@Tyriar Thx for insisting on the lower batch size in the first place, helped me to think around the nonsense re-scan penalty with exp growth - this runtime is better invested on coin miners 🤣 If you want to check again, imho this is ready to get added. 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
Should fix #4112.
TODO:
DebouncedIdleTask
to defer array buffer resize after shrinkingoptimizenot critical at allcopyCellsFrom
, check for correct _combined and _extendedAttr handling