wez / wezterm

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

Tragic performance #4583

Closed grappas closed 11 months ago

grappas commented 11 months ago

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

Linux Wayland

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

Hyprland 0.32.3.r21.91d6be1f-1

WezTerm version

20231112-171650-721fbdf5

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

On fast changing viewport there's ~5 second input lag and same frame time. Main selling point of an app is non existent and even worse than software accelerated terminal emulators.

To Reproduce

Foot for comparison:

https://github.com/wez/wezterm/assets/1036957/fea5fb98-04fe-4cfa-a879-d66566426931

Configuration

local wezterm = require 'wezterm'
local act = wezterm.action
local mykeys = {
}

local My_font_size = 14.0
local Font_size = My_font_size

function Recompute_font_size(window)
    local window_dims = window:get_dimensions()
    local overrides = window:get_config_overrides() or {}
    local Dpi = window_dims.dpi / 96
    local Scale_factor_general = 7
    local Scale_factor_x = window_dims.pixel_width / ( Scale_factor_general * 9 * Dpi )
    local Scale_factor_y = window_dims.pixel_height / ( Scale_factor_general * 7 * Dpi )
    local Scale_factor = Scale_factor_x

    if (Scale_factor_y > Scale_factor_x)
    then
        Scale_factor = Scale_factor_x
    else
        Scale_factor = Scale_factor_y
    end

    if Scale_factor > My_font_size
    then
        Font_size = My_font_size
    else
        Font_size = math.floor(Scale_factor)
    end
    overrides.font_size = Font_size
    window:set_config_overrides(overrides)
end

wezterm.on('window-resized', function(window)
    Recompute_font_size(window)
end)

for i = 1, 8 do
    -- CTRL+ALT + number to activate that tab
    table.insert(mykeys, {
        key = tostring(i),
        mods = 'CTRL|ALT',
        action = act.ActivateTab(i - 1),
    })
    -- F1 through F8 to activate that tab
    table.insert(mykeys, {
        key = 'F' .. tostring(i),
        action = act.ActivateTab(i - 1),
    })
end

if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
    Default_prog = { 'powershell.exe' }
else
    Default_prog = { 'zsh' }
end

if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
    Font = wezterm.font 'VictorMono NF'
else
    Font = wezterm.font 'VictorMono Nerd Font'
end

return {
    font = Font,
    font_size = Font_size,
    color_scheme = 'GruvboxDark',
    -- window_background_opacity = 0.9,
    window_close_confirmation = 'NeverPrompt',
    default_prog = Default_prog,
    enable_wayland = true,
    hide_tab_bar_if_only_one_tab = true,
    default_cursor_style = 'SteadyBlock',

    front_end = "OpenGL",

    keys = {
        -- {{{1
        {
            key = 'F1',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F2',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F3',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F4',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F5',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F6',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F7',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F8',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F9',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F10',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F11',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F12',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        -- }}}
    }
}

Expected Behavior

Smooth experience as advertised.

Logs

Debug Overlay
wezterm version: 20231112-171650-721fbdf5 x86_64-unknown-linux-gnu
Window Environment: Wayland
OpenGL: AMD Radeon RX 6750 XT (navi22, LLVM 16.0.6, DRM 3.54, 6.6.1-arch1-1) 4.6 (Compatibility Profile) Mesa 23.2.1-arch1.2
Enter lua statements or expressions and hit Enter.
Press ESC or CTRL-D to exit
00:21:26.807 DEBUG wezterm_term::screen > scroll_up_within_margins region:0..42 margins:0..88 rows=1
00:21:26.807 DEBUG wezterm_term::screen > scroll_up 0..42 num_rows=1 phys_scroll=3500..3542
00:21:26.807 DEBUG wezterm_term::terminalstate::performer > perform PrintString("37867")
00:21:26.807 DEBUG wezterm_term::terminalstate::performer > perform Control(CarriageReturn)
00:21:26.808 DEBUG wezterm_term::terminalstate::performer > perform Control(LineFeed)
00:21:26.808 DEBUG wezterm_term::screen > scroll_up_within_margins region:0..42 margins:0..88 rows=1
00:21:26.808 DEBUG wezterm_term::screen > scroll_up 0..42 num_rows=1 phys_scroll=3500..3542
00:21:26.808 DEBUG wezterm_term::terminalstate::performer > perform PrintString("37868")
00:21:26.808 DEBUG wezterm_term::terminalstate::performer > perform Control(CarriageReturn)
00:21:26.809 TRACE mux > read_pty pane 0 read 105 bytes
00:21:26.809 DEBUG wezterm_term::terminalstate::performer > perform Control(LineFeed)
00:21:26.809 DEBUG wezterm_term::screen > scroll_up_within_margins region:0..42 margins:0..88 rows=1
00:21:26.809 DEBUG wezterm_term::screen > scroll_up 0..42 num_rows=1 phys_scroll=3500..3542
00:21:26.809 DEBUG wezterm_term::terminalstate::performer > perform PrintString("37869")
00:21:26.809 TRACE mux > read_pty pane 0 read 280 bytes
00:21:26.809 DEBUG wezterm_term::terminalstate::performer > perform Control(CarriageReturn)
00:21:26.809 TRACE mux > read_pty pane 0 read 105 bytes
00:21:26.809 TRACE wezterm_term::terminalstate::performer > print x=0 y=41 print_width=1 width=88 cell=3 CellAttributes { attributes: 0, intensity: Normal, underline: None, blink: None, italic: false, reverse: false, strikethrough: false, invisible: false, wrapped: false, overline: false, semantic_type: Output, foreground: Default, background: Default, fat: None }
00:21:26.809 TRACE mux > read_pty pane 0 read 105 bytes
00:21:26.809 TRACE wezterm_term::terminalstate::performer > print x=1 y=41 print_width=1 width=88 cell=7 CellAttributes { attributes: 0, intensity: Normal, underline: None, blink: None, italic: false, reverse: false, strikethrough: false, invisible: false, wrapped: false, overline: false, semantic_type: Output, foreground: Default, background: Default, fat: None }
00:21:26.809 TRACE mux > read_pty pane 0 read 119 bytes
00:21:26.809 TRACE wezterm_term::terminalstate::performer > print x=2 y=41 print_width=1 width=88 cell=8 CellAttributes { attributes: 0, intensity: Normal, underline: None, blink: None, italic: false, reverse: false, strikethrough: false, invisible: false, wrapped: false, overline: false, semantic_type: Output, foreground: Default, background: Default, fat: None }
00:21:26.809 TRACE mux > read_pty pane 0 read 105 bytes
00:21:26.809 TRACE wezterm_term::terminalstate::performer > print x=3 y=41 print_width=1 width=88 cell=6 CellAttributes { attributes: 0, intensity: Normal, underline: None, blink: None, italic: false, reverse: false, strikethrough: false, invisible: false, wrapped: false, overline: false, semantic_type: Output, foreground: Default, background: Default, fat: None }
00:21:26.809 TRACE mux > read_pty pane 0 read 112 bytes
00:21:26.809 TRACE wezterm_term::terminalstate::performer > print x=4 y=41 print_width=1 width=88 cell=9 CellAttributes { attributes: 0, intensity: Normal, underline: None, blink: None, italic: false, reverse: false, strikethrough: false, invisible: false, wrapped: false, overline: false, semantic_type: Output, foreground: Default, background: Default, fat: None }

Anything else?

No response

uncomfyhalomacro commented 11 months ago

@grappas how did you build wezterm? what flags did you use?

grappas commented 11 months ago

It's compiled via AUR package.

grappas commented 11 months ago

@grappas how did you build wezterm? what flags did you use?

I just compiled and ran wezterm without any flags. Very same behaviour.

uncomfyhalomacro commented 11 months ago

odd. i just used seq 1 10000 to both. not too sure what im seeing. im also using latest git master or at least a very recent commit (if it changed now) from a few days ago. i cant replicate your bug report

grappas commented 11 months ago

What's your setup?

uncomfyhalomacro commented 11 months ago

i use opensuse tumbleweed. i maintain the unofficial wezterm package in opensuse - https://build.opensuse.org/package/show/X11:terminals/wezterm

so im still not sure how to replicate yours. mine is very close to latest commits hence the +git<number of commits> there

grappas commented 11 months ago

What I meant: what dm/compositor are you using?

uncomfyhalomacro commented 11 months ago

riverwm

grappas commented 11 months ago

Ah... shit. My bad.

WEZTERM_LOG=debug is set globally in my env. That was the cause. I'm very sorry for being an idiot. 🤦🤦🤦🤦🤦🤦

github-actions[bot] commented 10 months 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.