Skip to content
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

Performance degradation when quitting on Windows 10 #823

Closed
BuriedStPatrick opened this issue Jul 23, 2021 · 8 comments · Fixed by #867
Closed

Performance degradation when quitting on Windows 10 #823

BuriedStPatrick opened this issue Jul 23, 2021 · 8 comments · Fixed by #867
Labels
good first issue Good for newcomers help wanted Extra attention is needed windows
Milestone

Comments

@BuriedStPatrick
Copy link

Describe the bug
Since 0.16.0 and onwards, quitting GitUI seems to be significantly slower than it used to on Windows. This does not appear to be the case on my Linux machines, however.

To Reproduce
Steps to reproduce the behavior:

  1. Install gitui @ 0.16.2
  2. Run a terminal like cmd.exe (also tested in pwsh.exe)
  3. Navigate to a repository
  4. Open gitui in a repository
  5. Quit gitui
  6. Wait 1-3 seconds (unsure if depends on hardware specs and repository)

Expected behavior
On 0.15.0 gitui quits almost immediately. I would expect the same on 0.16.x+.

Screenshots
To better illustrate, here's a GIF where I compare the two versions:
gitui-performance

Context (please complete the following information):

  • OS/Distro + Version: Windows 10 Pro 10.0.19043 Build 19043
  • GitUI Version 0.16.2
  • Rust version: 1.5.0

Additional context
Installed through scoop. I've also tested on cargo install but the problem persists unfortunately.

@extrawurst extrawurst added windows help wanted Extra attention is needed labels Jul 23, 2021
@extrawurst
Copy link
Owner

@BuriedStPatrick thanks for reporting this. I have a hunch what it is related to but to confirm: what key bindings do you use and what exact key did you use to quit in this example. could you also test if quitting via ctrl+c performs faster?

@BuriedStPatrick
Copy link
Author

@extrawurst That's great news!
I used ctrl+c in both examples in the GIF.
Quitting with Q in v0.16.2 is seemingly equally as slow as with ctrl+c. (in v0.15.0 the Q keybinding isn't implemented it seems).

I can also reproduce this with both the standard cmd.exe as well as Windows Terminal.
I haven't changed any of the default keybindings as I quite like them :)

key_config.ron:

(
    tab_status: (
        code: Char('1'),
        modifiers: (
            bits: 0,
        ),
    ),
    tab_log: (
        code: Char('2'),
        modifiers: (
            bits: 0,
        ),
    ),
    tab_files: (
        code: Char('3'),
        modifiers: (
            bits: 0,
        ),
    ),
    tab_stashing: (
        code: Char('4'),
        modifiers: (
            bits: 0,
        ),
    ),
    tab_stashes: (
        code: Char('5'),
        modifiers: (
            bits: 0,
        ),
    ),
    tab_toggle: (
        code: Tab,
        modifiers: (
            bits: 0,
        ),
    ),
    tab_toggle_reverse: (
        code: BackTab,
        modifiers: (
            bits: 1,
        ),
    ),
    toggle_workarea: (
        code: Char('w'),
        modifiers: (
            bits: 0,
        ),
    ),
    focus_right: (
        code: Right,
        modifiers: (
            bits: 0,
        ),
    ),
    focus_left: (
        code: Left,
        modifiers: (
            bits: 0,
        ),
    ),
    focus_above: (
        code: Up,
        modifiers: (
            bits: 0,
        ),
    ),
    focus_below: (
        code: Down,
        modifiers: (
            bits: 0,
        ),
    ),
    exit: (
        code: Char('c'),
        modifiers: (
            bits: 2,
        ),
    ),
    quit: (
        code: Char('q'),
        modifiers: (
            bits: 0,
        ),
    ),
    exit_popup: (
        code: Esc,
        modifiers: (
            bits: 0,
        ),
    ),
    open_commit: (
        code: Char('c'),
        modifiers: (
            bits: 0,
        ),
    ),
    open_commit_editor: (
        code: Char('e'),
        modifiers: (
            bits: 2,
        ),
    ),
    open_help: (
        code: Char('h'),
        modifiers: (
            bits: 0,
        ),
    ),
    move_left: (
        code: Left,
        modifiers: (
            bits: 0,
        ),
    ),
    move_right: (
        code: Right,
        modifiers: (
            bits: 0,
        ),
    ),
    tree_collapse_recursive: (
        code: Left,
        modifiers: (
            bits: 1,
        ),
    ),
    tree_expand_recursive: (
        code: Right,
        modifiers: (
            bits: 1,
        ),
    ),
    home: (
        code: Home,
        modifiers: (
            bits: 0,
        ),
    ),
    end: (
        code: End,
        modifiers: (
            bits: 0,
        ),
    ),
    move_up: (
        code: Up,
        modifiers: (
            bits: 0,
        ),
    ),
    move_down: (
        code: Down,
        modifiers: (
            bits: 0,
        ),
    ),
    page_down: (
        code: PageDown,
        modifiers: (
            bits: 0,
        ),
    ),
    page_up: (
        code: PageUp,
        modifiers: (
            bits: 0,
        ),
    ),
    shift_up: (
        code: Up,
        modifiers: (
            bits: 1,
        ),
    ),
    shift_down: (
        code: Down,
        modifiers: (
            bits: 1,
        ),
    ),
    enter: (
        code: Enter,
        modifiers: (
            bits: 0,
        ),
    ),
    blame: (
        code: Char('B'),
        modifiers: (
            bits: 1,
        ),
    ),
    edit_file: (
        code: Char('e'),
        modifiers: (
            bits: 0,
        ),
    ),
    status_stage_all: (
        code: Char('a'),
        modifiers: (
            bits: 0,
        ),
    ),
    status_reset_item: (
        code: Char('D'),
        modifiers: (
            bits: 1,
        ),
    ),
    status_ignore_file: (
        code: Char('i'),
        modifiers: (
            bits: 0,
        ),
    ),
    diff_stage_lines: (
        code: Char('s'),
        modifiers: (
            bits: 0,
        ),
    ),
    diff_reset_lines: (
        code: Char('d'),
        modifiers: (
            bits: 0,
        ),
    ),
    stashing_save: (
        code: Char('s'),
        modifiers: (
            bits: 0,
        ),
    ),
    stashing_toggle_untracked: (
        code: Char('u'),
        modifiers: (
            bits: 0,
        ),
    ),
    stashing_toggle_index: (
        code: Char('i'),
        modifiers: (
            bits: 0,
        ),
    ),
    stash_apply: (
        code: Char('a'),
        modifiers: (
            bits: 0,
        ),
    ),
    stash_open: (
        code: Right,
        modifiers: (
            bits: 0,
        ),
    ),
    stash_drop: (
        code: Char('D'),
        modifiers: (
            bits: 1,
        ),
    ),
    cmd_bar_toggle: (
        code: Char('.'),
        modifiers: (
            bits: 0,
        ),
    ),
    log_tag_commit: (
        code: Char('t'),
        modifiers: (
            bits: 0,
        ),
    ),
    commit_amend: (
        code: Char('a'),
        modifiers: (
            bits: 2,
        ),
    ),
    copy: (
        code: Char('y'),
        modifiers: (
            bits: 0,
        ),
    ),
    create_branch: (
        code: Char('c'),
        modifiers: (
            bits: 0,
        ),
    ),
    rename_branch: (
        code: Char('r'),
        modifiers: (
            bits: 0,
        ),
    ),
    select_branch: (
        code: Char('b'),
        modifiers: (
            bits: 0,
        ),
    ),
    delete_branch: (
        code: Char('D'),
        modifiers: (
            bits: 1,
        ),
    ),
    merge_branch: (
        code: Char('m'),
        modifiers: (
            bits: 0,
        ),
    ),
    tags: (
        code: Char('T'),
        modifiers: (
            bits: 1,
        ),
    ),
    delete_tag: (
        code: Char('D'),
        modifiers: (
            bits: 1,
        ),
    ),
    select_tag: (
        code: Enter,
        modifiers: (
            bits: 0,
        ),
    ),
    push: (
        code: Char('p'),
        modifiers: (
            bits: 0,
        ),
    ),
    open_file_tree: (
        code: Char('F'),
        modifiers: (
            bits: 1,
        ),
    ),
    force_push: (
        code: Char('P'),
        modifiers: (
            bits: 1,
        ),
    ),
    pull: (
        code: Char('f'),
        modifiers: (
            bits: 0,
        ),
    ),
    abort_merge: (
        code: Char('M'),
        modifiers: (
            bits: 1,
        ),
    ),
    undo_commit: (
        code: Char('U'),
        modifiers: (
            bits: 1,
        ),
    ),
)

@extrawurst
Copy link
Owner

@BuriedStPatrick ok then my theory is wrong. could you do 2 things:

@BuriedStPatrick
Copy link
Author

@extrawurst Here you go :)

Software version

gitui 0.16.2 (aacc7a3-modified)

Operating system

Windows 6.2.9200

Compile time information

  • Profile: release
  • Target triple: x86_64-pc-windows-msvc
  • Family: windows
  • OS: windows
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-pc-windows-msvc

Environment variables

SHELL=<not set>
EDITOR=<not set>
GIT_EDITOR=<not set>
VISUAL=<not set>

Command-line

C:\Users\patrick.christensen\scoop\apps\gitui\current\gitui.exe --bugreport

Log when running v0.15.0:

14:36:11 [TRACE] (1) gitui::app: [src\app.rs:305] update
14:36:11 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 4747929034360955961] (type: WorkingDir, untracked: true)
14:36:11 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:95] request: [hash: 11643232720821160596] (type: Stage, untracked: true)
14:36:11 [TRACE] (3) asyncgit::status: [asyncgit\src\status.rs:152] status fetched: 11643232720821160596 (type: Stage, untracked: true)
14:36:11 [TRACE] (2) asyncgit::status: [asyncgit\src\status.rs:152] status fetched: 4747929034360955961 (type: WorkingDir, untracked: true)
14:36:11 [TRACE] (1) gitui::app: [src\app.rs:237] event: Input(Resize(118, 30))
14:36:11 [TRACE] (1) gitui::app: [src\app.rs:323] update_git: Status
14:36:11 [TRACE] (1) gitui::app: [src\app.rs:323] update_git: Status
14:36:12 [TRACE] (1) gitui::app: [src\app.rs:237] event: Input(Key(KeyEvent { code: Char('c'), modifiers: CONTROL }))

Log when running v.0.16.2 (seems to throw an error at the end there 🤔):

14:37:03 [TRACE] (1) gitui::app: [src\app.rs:330] update
14:37:03 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:90] request: [hash: 18048908903348948695] (type: WorkingDir)
14:37:03 [TRACE] (1) asyncgit::status: [asyncgit\src\status.rs:90] request: [hash: 6368461436514963192] (type: Stage)
14:37:03 [TRACE] (4) asyncgit::status: [asyncgit\src\status.rs:143] status fetched: 6368461436514963192 (type: Stage)
14:37:03 [TRACE] (2) asyncgit::status: [asyncgit\src\status.rs:143] status fetched: 18048908903348948695 (type: WorkingDir)
14:37:03 [TRACE] (1) gitui::app: [src\app.rs:261] event: Input(Resize(118, 30))
14:37:03 [TRACE] (1) gitui::app: [src\app.rs:349] update_git: Status
14:37:03 [TRACE] (1) gitui::app: [src\app.rs:349] update_git: Status
14:37:04 [TRACE] (1) gitui::app: [src\app.rs:261] event: Input(Key(KeyEvent { code: Char('c'), modifiers: CONTROL }))
14:37:04 [ERROR] input thread error: sending on a disconnected channel

@extrawurst extrawurst added the good first issue Good for newcomers label Aug 20, 2021
@Icxolu
Copy link

Icxolu commented Aug 20, 2021

It seems this was introduced in 423a014.
Specifically this

process::abort();
seems to cause the problem.

When executing with cargo run it also gives an additional error code, which is not shown when just executing directly:
error: process didn't exit successfully: `target\debug\gitui.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

Changing process::abort() into process::exit(<exit code>) or removing it seems to remove the delay again.

The logged error is still there, but i guess this is the expected (?) behavior.

extrawurst pushed a commit that referenced this issue Aug 21, 2021
rather perform a graceful shutdown
@extrawurst
Copy link
Owner

@BuriedStPatrick @Icxolu can you test the branch fix-823-quit-delay-windows with b1bacbe and let me know if this fixes the close-delay?

@Icxolu
Copy link

Icxolu commented Aug 21, 2021

@extrawurst This fixes it for me, I can't observe any close-delay anymore.

extrawurst pushed a commit that referenced this issue Aug 21, 2021
rather perform a graceful shutdown
@extrawurst extrawurst added this to the v0.17 milestone Aug 21, 2021
@BuriedStPatrick
Copy link
Author

BuriedStPatrick commented Aug 22, 2021

@extrawurst @Icxolu Can confirm on my end as well. Thanks, and good work! :)

One thing of note when attempting to test: I had trouble installing the specific branch with cargo due to a dependency on Perl in Windows. Apparently Perl ships with Windows, but isn't compatible with the openssl-sys implementation due to Windows-style file paths.

To fix this, so I could test gitui, I simply installed Perl manually with winget, which solved the issue for me, letting me compile:

winget install StrawberryPerl.StrawberryPerl

extrawurst pushed a commit to andrewpollack/gitui that referenced this issue Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants