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

optimization: Speed up pane switching by circumventing shell and tmux CLI when possible #29

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

srithon
Copy link

@srithon srithon commented Sep 1, 2024

  1. Motivation for circumventing Shell: Shell startup time is significant. For some reason, as @isaksamsten mentioned on faster window switching #16, switching is significantly slower in Fish shell than in other shells. I did some experimentation and found that vim.fn.system(<string>) is slow when the shell option is set to Fish. This change removes dependence on the shell entirely when switching tmux panes, since system doesn't use a shell when a table is provided in place of a string.
  2. Motivation for short circuiting zoom check: This lets us cut out the latency from invoking tmux at all, when a faster boolean check would rule out the conditional

Shell startup time is significant. For some reason, as @isaksamsten
mentioned on alexghergh#16, switching is significantly slower in Fish shell than
in other shells. I did some experimentation and found that
`vim.fn.system(<string>)` is slow when the `shell` option is set to
Fish. This change removes dependence on the shell entirely when
switching tmux panes, since `system` doesn't use a shell when a table is
provided in place of a string.
…ontrol

This change cuts out the `tmux` CLI invocation when
`disable_nav_when_zoomed = false`.

This reordering was necessary to enable this workaround because the
`and` operator is short-circuiting, and thus it will only evaluate the
RHS if the LHS is `true`. Before, the slow function call was the LHS,
and so it was being evaluated unconditionally, even when the
significantly faster boolean check would have failed.
@srithon srithon changed the title optimization: Speed up pane switching when disable_nav_when_zoomed = false optimization: Speed up pane switching by circumventing shell and tmux CLI when possible Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant