-
-
Notifications
You must be signed in to change notification settings - Fork 807
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
wezterm lags with fast output in another pane/window, with format-tab-title
event _and_ large keys
/key_table
#4788
Comments
keys
/key_table
_and_ format-tab-title
eventformat-tab-title
event _and_ large keys
/key_table
FWIW, I'm also seeing performance problems with wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width)
return {
{ Text = "TEST" },
}
end) If I have a This is on |
Here's a minimal reproducer, pared down from my config: local wezterm = require 'wezterm'
local config = {}
config.color_schemes = wezterm.get_builtin_color_schemes()
wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width)
return {
{ Text = "TEST" },
}
end)
return config The latency increases (maybe quadratic?) proportional to the number of tabs, whether those tabs are in one window or a bunch of windows containing a single tab. Each time I create a new tab, the time to display the new tab grows longer and longer. To justify the presence of that config.color_scheme = 'Tango (terminal.sexy)'
-- make the scrollbar thumb more visible
config.color_schemes = wezterm.get_builtin_color_schemes()
local color_scheme = config.color_schemes[config.color_scheme]
color_scheme.scrollbar_thumb = "555555" I still want all of the built-in themes available to play around with, but I also wanted to tweak the If I keep the config.color_scheme = 'Tango (terminal.sexy)'
-- make the scrollbar thumb more visible
local color_schemes = wezterm.get_builtin_color_schemes()
config.color_schemes = {
[config.color_scheme] = color_schemes[config.color_scheme]
}
local color_scheme = color_schemes[config.color_scheme]
color_scheme.scrollbar_thumb = "555555" It's odd that settings a callback for the |
With I'll see if I can get a screen recording to demo. |
Wait, so for you even |
If I also have any configured |
This is not the case for me. If I remove only the key table from my config, things are fine |
I think I've found what's wrong/weird. I've added some logging around when Here's the numbers for my full config:
and here are the numbers when the
|
for me, I'll remove the tab title update on those 2 instances, and test drive for probably about a week, and report back. what I can say for now is, with those removed, it's not yet possible for me to reproduce the issue |
After a week of (heavy) use, can't feel any lag I felt before. However, tab title updating doesn't always happen when it should. For example, the tab title doesn't always update when switching panes. That's not a big issue for me, as I almost always rename the tab to something, but I'll look into it sometime |
Thanks for diving into this! Like any good problem, it seems like there are layers that combine to make things painful. Here's my quick take:
function get_schemes()
local schemes = wezterm.GLOBAL.color_schemes
if schemes then
return schemes
end
wezterm.GLOBAL.color_schemes = wezterm.get_builtin_color_schemes()
return wezterm.GLOBAL.color_schemes
end
config.color_schemes = get_schemes()
|
re: diff --git a/term/src/terminalstate/mod.rs b/term/src/terminalstate/mod.rs
index f18ad0b6b..6d3476c9b 100644
--- a/term/src/terminalstate/mod.rs
+++ b/term/src/terminalstate/mod.rs
@@ -379,6 +379,7 @@ pub struct TerminalState {
accumulating_title: Option<String>,
lost_focus_seqno: SequenceNo,
+ lost_focus_alerted_seqno: SequenceNo,
focused: bool,
/// True if lines should be marked as bidi-enabled, and thus
@@ -575,6 +576,7 @@ impl TerminalState {
enable_conpty_quirks: false,
accumulating_title: None,
lost_focus_seqno: seqno,
+ lost_focus_alerted_seqno: seqno,
focused: true,
bidi_enabled: None,
bidi_hint: None,
@@ -795,8 +797,11 @@ impl TerminalState {
pub(crate) fn trigger_unseen_output_notif(&mut self) {
if self.has_unseen_output() {
- if let Some(handler) = self.alert_handler.as_mut() {
- handler.alert(Alert::OutputSinceFocusLost);
+ if self.lost_focus_seqno > self.lost_focus_alerted_seqno {
+ self.lost_focus_alerted_seqno = self.seqno;
+ if let Some(handler) = self.alert_handler.as_mut() {
+ handler.alert(Alert::OutputSinceFocusLost);
+ }
}
}
} the intent is to only send one alert after losing focus, but to allow more alerts again after regaining and subsequently losing focus. |
What is this referring to? I don't think I have this in my dotfiles (can check more when I get back)
Yeah, especially at work. Because I often need to context switch between things, some including some compilations that produces a lot of output. It might not even be background, depending on your definition, cuz it might just be a pane on the side
But that would be for the status widgets/bar right? Not tab titles?
Yes
Yes I'm trying something like that |
* Removed title update from main render loop * Add to PaneFocused event * term: only emit Alert::OutputSinceFocusLost for the first seqno bump after losing focus, rather than on every bump. That event indirectly causes the title to update refs: #4788
It's part of the discussion on this issue.
It's the "same thing" from the perspective of rendering that part of the display; if either of them change, then both need to be rendered. |
I've pushed a commit that I think tackles the heart of this issue, which is cutting down the per-paint and per-output-event triggers for Please give it a try and let me know how you get on! It typically takes about an hour before commits are available as nightly builds for all platforms. Linux builds are the fastest to build and are often available within about 20 minutes. Windows and macOS builds take a bit longer. You can find the nightly downloads for your system in the wezterm installation docs. If you prefer to use packages provided by your distribution or package manager of choice and don't want to replace that with a nightly download, keep in mind that you can download portable packages (eg: a If you are eager and can build from source then you may be able to try this out more quickly. |
Thanks, I'll test drive this tomorrow and let you know how it goes |
No problems running with this patch as far as I can tell. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
What Operating System(s) are you seeing this problem on?
Linux X11, macOS
Which Wayland compositor or X11 Window manager(s) are you using?
Awesomewm
WezTerm version
20240102-011725-2f7ca41a
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
Yes, and I updated the version box above to show the version of the nightly that I tried
Describe the bug
The reproduction below should describe what the bug is.
This quite weird as the lag only happens when the focus is on the pane without the large output. I was trying to use vtebench to see what the problem could be, and it's definitely not output ingestion rate (which is what vtebench solely tests). Focusing on another pane or not, with fast output running, doesn't really change the results vtebench gives
The lag completely goes away with either the
format-tab-title
callback removed (even changing it to something very simple likereturn '42'
doesn't help), or removing thekeys
/key_table
options. It doesn't seem like a section of thekey_table
introduces the issue, as commenting out parts of it improves the lag, but not completely remove it.Removing any other config options does nothing.
To Reproduce
Configuration
config.lua
Expected Behavior
No response
Logs
No response
Anything else?
I'm currently testing out #4737, hence the version. But I've had the problem for quite a while now (starting with the
20230712-072601-f4abf8fd
release, with some nightly builds in between), with the config barely changing. However, I haven't tested if removingformat-tab-title
orkeys
/key_table
alleviates the problem on Mac or older versions.I think this is a GUI rendering issue, but not because of the rendering backend. I have a 16" Macbook Pro (M2) for work, and the lag occurs on that and my linux laptop which barely has a GPU:
wezterm.gui.enumerate_gpus()
on my linux laptopIf there are any testing/logging options/patches, I'm happy to try/build.
The text was updated successfully, but these errors were encountered: