-
-
Notifications
You must be signed in to change notification settings - Fork 673
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
Zellij hangs with 100% CPU when opening a new pane with a very long line on screen #2622
Comments
Yes, very annoying bug. |
For watchers of this issue, my two PRs linked above improve the situation by at least 10x, more for longer lines (as some of the behavior was quadratic). Up to 10MB lines the performance is now tolerable. If you're building for yourself, take the second PR - it includes all commits from the first. Edit: it's now a series of three, take the third i.e. #3043 if you're building for yourself. |
The three PRs have been merged and presumably will be in the next release. In the original test case, trying to split to a new pane might respond in about 5 mins (sometimes less, sometimes more). After the changes, it takes <10s for me - not fast, but at least you can slowly navigate back to the original pane and I am ok with this performance for now. Not ideal, but good enough that I don't need to force close sessions - I don't mind if this issue is closed. For future people wanting to look at this issue, I'd start by looking at reducing memory copies. If you open I suspect the eventual solution is to have all characters in a single block in memory, and then perform re-splitting and combining of rows by indexing into this big block of memory and shifting around the index points. This eliminates all terminal characters copies when performing row split/merge. You'll want a wrapper datastructure that does the bookkeeping for you and has a special 'index' type rather than a plain usize. The trickiest part of this is managing memory correctly to allow adding/removing characters to the grid:
[0] though honestly I think a configurable character limit upper bound for sanity reasons is reasonable - I don't think any user seriously wants 100 million character scrollback in a single pane Finally, here's the script I was using for benchmarking/profiling for the record Script for profiling
|
Reproduction:
Wait for 5s then hit ctrl+c. Now attempt to open a new pane with ctrl+p, n. Zellij will be unresponsive and taking 100% of a CPU.
The text was updated successfully, but these errors were encountered: