catppuccin / tmux

💽 Soothing pastel theme for Tmux
MIT License
1.94k stars 615 forks source link

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

Closed MightyCoderX closed 3 months ago

MightyCoderX commented 4 months ago

Is there an existing issue outlining your 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 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com: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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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

vdbe commented 4 months ago

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 commented 4 months ago

Was it fixed? It now seems to start blazingly fast

MightyCoderX commented 4 months ago

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 commented 4 months ago

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

vdbe commented 3 months ago

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