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

Slow tmux startup time (almost 1s) on initial server start-up #258

Closed
1 task done
MightyCoderX opened this issue Jul 22, 2024 · 8 comments
Closed
1 task done

Slow tmux startup time (almost 1s) on initial server start-up #258

MightyCoderX opened this issue Jul 22, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@MightyCoderX
Copy link

Is there an existing issue outlining your problem?

  • I have searched the existing issues and they do not solve my problem.

Describe your problem.

Starting a new tmux sessions takes almost 1 second! When the plugin is disabled it only takes about 100ms.

I also tried to use sh which on my system is just a symlink to bash but without customizations from ~/.bashrc, and zsh which I just installed and configured with new-user function.

The problem still presents itself in any shell, and doesn't present when all catpuccin related lines are commented out in tmux.conf, and thus I isolated it to catpuccin.

Paste your configuration.

set-option -g default-terminal "tmux-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"

set-option -g status-keys vi

set-option -g prefix C-s


set-option -g base-index 1
set-option -g pane-base-index 1


# set-option -g display_time 2000
# set-option -g display-time 2000

set-option -g repeat-time 0
set-option -g escape-time 0


set-option -g mouse on

bind-key r source-file ~/.config/tmux/tmux.conf\; display-message "Reloaded configuration"
bind-key y set-window-option synchronize-panes\; display-message "synchronize mode toggled."

# Use vim keys to move between panes
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R

set-option -g status-position top

# TPM
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'catppuccin/tmux'

set -g @catppuccin_flavour 'mocha'
source-file ~/.config/tmux/catppuccin/config3.conf

# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin '[email protected]:user/plugin'
# set -g @plugin '[email protected]:user/plugin'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

Attach screenshots.

Catpuccin commented out:
image

Catpuccin enabled with defaults:
image
The time varies between >500ms and <1000ms

What tmux version are you seeing the issue on?

tmux 3.4

Any additional comments?

config3.conf (in the tmux.conf) is one of the example configs you offer, the problem happens even removing that line, thus using the hard-coded defaults in the plugin's scripts

Terminal: Alacritty
OS: Fedora Linux 40
WM: Hyprland

Directory Tree:

.dotfiles/.config/tmux (symlinked to .config/tmux)
├── catppuccin
│   ├── config1.conf
│   ├── config2.conf
│   └── config3.conf
├── plugins
│   ├── .keep
│   ├── tmux
│   └── tpm
├── tmux.conf
└── tmux.conf.old
@MightyCoderX MightyCoderX added the bug Something isn't working label Jul 22, 2024
@MightyCoderX
Copy link
Author

The sleep time is so tmux doesn't spit random string of characters because it's closed too fast, even without that the timing sometimes went up to >900ms.
Just subtract it for an "accurate" timing.

@vdbe
Copy link
Contributor

vdbe commented Jul 22, 2024

I am currently working on speeding this up in #240 any/all feedback is welcome.
The main problem is tmux is currently called once per option PR 240 tries to batch this.

@MightyCoderX
Copy link
Author

I've seen another similiar PR #29 which was already merged, what happened with that?

@vdbe
Copy link
Contributor

vdbe commented Jul 22, 2024

That one batched the set command 240 batches the show command. The biggest problem for batching the show is the older bash version used by apple doesn't have associative arrays bash making the implementation a bit ugly. If the batching is still not fast enough you could have two implementions based on the bash version but lets hope not.

@MightyCoderX
Copy link
Author

Was it fixed? It now seems to start blazingly fast

@MightyCoderX
Copy link
Author

I noticed it only happens when you start the first session and thus tmux-server, if I start a session when the server is already running it's fast

@vdbe
Copy link
Contributor

vdbe commented Jul 24, 2024

That is because it only runs during server start. If the serve/socket already exists it just attaches to it.

@sgoudham sgoudham changed the title Slow tmux startup time (almost 1s) when plugin is enabled Slow tmux startup time (almost 1s) on initial server start-up Jul 28, 2024
@vdbe
Copy link
Contributor

vdbe commented Aug 5, 2024

batching of tmux show-options (#240) has been merged so first startup should be a lot faster now.

@vdbe vdbe closed this as completed Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants