wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
16.67k stars 745 forks source link

Slow #3042

Closed ibardarov-fms closed 1 year ago

ibardarov-fms commented 1 year ago

What Operating System(s) are you seeing this problem on?

Linux X11, Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

I don't know if I am on Wayland or pure X11. I am on "Ubuntu 22.04.1 LTS.

WezTerm version

wezterm 20221119-145034-49b9839f

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

Hello, I start wezterm. It works nice. I can switch firefox - wezterm - whatever - wezterm instantly.

After of 5-10min of work with the wezterm the switching becomes very slow. I can't and I don't want to close my work in the wezterm so the switching becomes insane slow. I press alt-tab, then nothing hapend and after 10 sec the wezterm apears on the screen.

I am not sure if the full screen was helping on that.

To Reproduce

just work with wezterm and some other program. try to switch between the screens.

Configuration

local wezterm = require "wezterm"
local custom_keys = {}

for i = 1, 9 do
  table.insert(custom_keys, {
    key = tostring(i),
    mods = 'ALT',
    action = wezterm.action_callback(function(win, pane)
      local mux_window = win:mux_window()

      while #mux_window:tabs() < i do
        mux_window:spawn_tab { }
      end

      win:perform_action(wezterm.action.ActivateTab(i - 1), pane)
    end),
  })
end

-- local gitbash = {"C:\\Program Files\\Git\\bin\\bash.exe", "-i", "-l"}
return {
    -- webgpu_preferred_adapter = gpus[0],
    -- front_end = "WebGpu",
    -- https://github.com/wez/wezterm/issues/2756
    -- local gpus = wezterm.gui.enumerate_gpus()
    webgpu_preferred_adapter={
      backend="Vulkan",
      device_type="Cpu",
      name="llvmpipe (LLVM 13.0.1, 256 bits)"
    },
    keys = custom_keys,
    -- color_scheme = "Dracula",
    -- color_scheme = "kanagawabones",
    color_scheme = "Kasugano (terminal.sexy)",
    colors = {
        -- The default text color
        -- The default background color
        foreground = '#fcfcfc',
        background = '#232627',
    },
    -- default_prog = gitbash,
    -- keys = {
    --     {
    --         key = "F3",
    --         action = "ShowLauncher",
    --     },
    --     {
    --         key = "Y",
    --         mods = "CTRL",
    --         action = "Copy",
    --     },
    --     {
    --         key = "C",
    --         mods = "CTRL",
    --         action = "DisableDefaultAssignment",
    --     },
    --     {
    --         key = " ",
    --         mods = "CTRL|SHIFT",
    --         action = "ActivateCopyMode",
    --     },
    --     {
    --         key = "9",
    --         mods = "ALT",
    --         action = "DisableDefaultAssignment",
    --     },
    -- },

    -- ssh_domains = {
    --     {
    --         name = "RPI",
    --         remote_address = "192.168.2.5",
    --         username = "pi",
    --     }
    -- },

    -- https://wezfurlong.org/wezterm/config/fonts.html
    font = wezterm.font('Cascadia Code', {}),
    font_size = 11.0,
    -- font_dirs = {"C:\\Windows\\Fonts"},
    -- font_rules = {
    --     {
    --         italic = false,
    --         bold = false,
    --         font = wezterm.font("Iosevka Nerd Font Complete"),
    --     },
    --     {
    --         italic = true,
    --         bold = false,
    --         font = wezterm.font("Iosevka Italic Nerd Font Complete"),
    --     },
    --     {
    --         italic = false,
    --         bold = true,
    --         font = wezterm.font("Iosevka Bold Nerd Font Complete"),
    --     },
    --     {
    --         italic = true,
    --         bold = true,
    --         font = wezterm.font("Iosevka Bold Italic Nerd Font Complete"),
    --     },
    -- },
    enable_scroll_bar = true,
    enable_scroll_bar = false,
    launch_menu = {
        {
            label = "Arch WSL",
            args = {"wsl", "-d", "Arch"},
        },
        {
            label = "Ubuntu WSL",
            args = {"wsl", "-d", "Ubuntu-20.04"},
        },
        {
            label = "Powershell",
            args = {"powershell"},
        },
        {
            label = "Git Bash",
            args = gitbash,
        },
    },
}

Expected Behavior

To have instant switching

Logs

Debug Overlay
wezterm version: 20221119-145034-49b9839f
OpenGL version: llvmpipe (LLVM 13.0.1, 256 bits) 4.5 (Compatibility Profile) Mesa 22.0.5
Enter lua statements or expressions and hit Enter.
Press ESC or CTRL-D to exit
12:50:07.455 WARN mux::localpane > unknown DeviceControlMode::Enter EnterDeviceControlMode(params: [], intermediates: [], byte: 'z' 0x7a, ignored_extra_intermediates=false)
12:50:07.455 WARN mux::localpane > unhandled DeviceControlMode::Data 7a z
12:50:07.460 WARN wezterm_term::terminalstate::performer > unknown unspecified CSI: "0%m"
12:50:14.235 WARN mux::localpane > unknown DeviceControlMode::Enter EnterDeviceControlMode(params: [], intermediates: [], byte: 'z' 0x7a, ignored_extra_intermediates=false)
12:50:14.235 WARN mux::localpane > unhandled DeviceControlMode::Data 7a z
12:50:14.235 WARN wezterm_term::terminalstate::performer > unknown unspecified CSI: "0%m"

Anything else?

No response

wez commented 1 year ago

You've configured wezterm to use CPU based rendering which is not as fast as GPU rendering. Was that intentional?

Please open the debug overlay (CTRL-SHIFT-L) and type in:

wezterm.gui.enumerate_gpus()

and share the output here.

ibardarov-fms commented 1 year ago

I have start changing the configuration hoping that it would help. I found #2756 and was pretty sure I am switching to the GPU rendering.

here is the output wezterm.gui.enumerate_gpus()

[
    {
        "backend": "Vulkan",
        "device": 0,
        "device_type": "Cpu",
        "driver": "llvmpipe",
        "driver_info": "Mesa 22.0.5 (LLVM 13.0.1)",
        "name": "llvmpipe (LLVM 13.0.1, 256 bits)",
        "vendor": 65541,
    },
    {
        "backend": "Gl",
        "device": 0,
        "device_type": "Cpu",
        "name": "llvmpipe (LLVM 13.0.1, 256 bits)",
        "vendor": 65541,
    },
]

This is Legion Lenovo gamer notebook which doesn't have proper support for Nvidia, so I have set in the bios to use the embeded graphics card instead of the gamers one.

But how the rendering is related to the app switching? The delay becomes bigger when do alt-tab switching - when the wezterm is focused and visible it is fast.

wez commented 1 year ago

both of those available options are Cpu based renderers and will be slow, especially when the screen area is large. If you can configure your system to use your Gpu instead, you will experience improved performance.

I would also suggest trying a nightly build to see if some other performance improvements make a difference to your workflow.

ibardarov-fms commented 1 year ago

When it is a fresh run, the alt-tab works fast and there is no lag. The lag appears after minutes of working time.

github-actions[bot] commented 1 year ago

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.