gpakosz / .tmux

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️
MIT License
21.9k stars 3.36k forks source link

Why first tmux start for plugins is so slow? #713

Closed DDGRCF closed 8 months ago

DDGRCF commented 8 months ago

(Ubuntu22.04 Alacritty) I just add two line code into .tmux.conf.local, like below set -g @plugin 'wfxr/tmux-power' set -g @tmux_power_theme '#8AADF4' But, when I start tmux first time, it appear to start slowly. (about 5~10 second)

gpakosz commented 8 months ago

Hello @DDGRCF

Can you please the gh-713 branch?

I instrumented TPM operations and the tpm_log.txt log now has timestamps

DDGRCF commented 8 months ago

tpm_log.txt

[2024-01-26 17:20:45.197]    List of discovered tpm plugins: wfxr/tmux-power
[2024-01-26 17:20:45.204]    Invoking /home/r/.tmux/plugins/tpm/bin/install_plugins
[2024-01-26 17:20:45.223]    Installing "tmux-power"
[2024-01-26 17:20:50.054]      "tmux-power" download success

[2024-01-26 17:21:06.540]    List of discovered tpm plugins: wfxr/tmux-power
[2024-01-26 17:21:06.550]    Invoking /home/r/.tmux/plugins/tpm/bin/install_plugins
[2024-01-26 17:21:06.569]    Already installed "tmux-power"
[2024-01-26 17:21:06.578]    Invoking /home/r/.tmux/plugins/tpm/bin/update_plugins all
[2024-01-26 17:21:06.588]    Updating all plugins!
[2024-01-26 17:21:06.588]
[2024-01-26 17:21:10.742]      "tmux-power" update success
[2024-01-26 17:21:10.744]        | 已经是最新的。
[2024-01-26 17:21:10.758]    Invoking /home/r/.tmux/plugins/tpm/bin/clean_plugins all

[2024-01-26 17:26:15.372]    List of discovered tpm plugins: wfxr/tmux-power
[2024-01-26 17:26:15.379]    Invoking /home/r/.tmux/plugins/tpm/bin/install_plugins
[2024-01-26 17:26:15.404]    Already installed "tmux-power"
[2024-01-26 17:26:15.417]    Invoking /home/r/.tmux/plugins/tpm/bin/update_plugins all
[2024-01-26 17:26:15.427]    Updating all plugins!
[2024-01-26 17:26:15.427]
[2024-01-26 17:26:19.353]      "tmux-power" update success
[2024-01-26 17:26:19.356]        | 已经是最新的。
[2024-01-26 17:26:19.368]    Invoking /home/r/.tmux/plugins/tpm/bin/clean_plugins all
gpakosz commented 8 months ago

So each time there's a an empty line in the log is when the tmux configuration was loaded or reloaded.

[2024-01-26 17:20:45.197]    List of discovered tpm plugins: wfxr/tmux-power
[2024-01-26 17:20:45.204]    Invoking /home/r/.tmux/plugins/tpm/bin/install_plugins
[2024-01-26 17:20:45.223]    Installing "tmux-power"
[2024-01-26 17:20:50.054]      "tmux-power" download success

Unfortunately TPM takes 5s on your network to clone the tmux-power repository

gpakosz commented 8 months ago

I updated the gh-713 branch so as to launch TPM right away when it's already cloned.

Which means the very first time TPM and plugins are cloned, it's still going to be as fast as your internet connection. But then it can load plugins already cloned before updating them or installing some more.

gpakosz commented 8 months ago

Hello @DDGRCF,

Did you get the chance to try the latest version of the gh-713 branch and see if it improves your situation?

DDGRCF commented 8 months ago

Hello @DDGRCF,

Did you get the chance to try the latest version of the gh-713 branch and see if it improves your situation?

yeh! A little better than before, but still not instant

DDGRCF commented 8 months ago
Invoking /home/r/.tmux/plugins/tpm/bin/clean_plugins all ...
[2024-01-29 13:45:21.926]    List of discovered tpm plugins: wfxr/tmux-power tmux-plugins/tmux-copycat tmux-plugins/tmux-cpu tmux-plugins/tmux-resurrect tmux-plugins/tmux-continuum
[2024-01-29 13:45:21.934]    Invoking /home/r/.tmux/plugins/tpm/bin/install_plugins
[2024-01-29 13:45:21.954]    Installing "tmux-resurrect"
[2024-01-29 13:45:21.954]    Installing "tmux-copycat"
[2024-01-29 13:45:21.954]    Installing "tmux-cpu"
[2024-01-29 13:45:21.955]    Already installed "tmux-power"
[2024-01-29 13:45:21.955]    Installing "tmux-continuum"
[2024-01-29 13:45:26.476]      "tmux-continuum" download success
[2024-01-29 13:45:26.920]      "tmux-cpu" download success
[2024-01-29 13:45:26.946]      "tmux-copycat" download success
[2024-01-29 13:45:31.784]      "tmux-resurrect" download success
[2024-01-29 13:45:31.802]    Invoking /home/r/.tmux/plugins/tpm/bin/update_plugins all
[2024-01-29 13:45:31.814]    Updating all plugins!
[2024-01-29 13:45:31.814]    
[2024-01-29 13:45:34.710]      "tmux-cpu" update success
[2024-01-29 13:45:34.710]      "tmux-continuum" update success
[2024-01-29 13:45:34.711]        | 已经是最新的。
[2024-01-29 13:45:34.711]        | 已经是最新的。
[2024-01-29 13:45:34.714]      "tmux-power" update success
[2024-01-29 13:45:34.715]        | 已经是最新的。
[2024-01-29 13:45:34.798]      "tmux-copycat" update success
[2024-01-29 13:45:34.801]        | 已经是最新的。
[2024-01-29 13:45:35.809]      "tmux-resurrect" update success
[2024-01-29 13:45:35.813]        | 已经是最新的。
[2024-01-29 13:45:35.828]    Invoking /home/r/.tmux/plugins/tpm/bin/clean_plugins all
gpakosz commented 8 months ago

Well it's TPM doing its work and there's pretty much nothing I can do about it unfortunately. All that is already happening in a background job and doesn't block interacting with tmux and the plugins already present on your filesystem