-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
bug: Prezto completion module is much slower than "vanilla" prezto #2255
Comments
Hi, Does a vanilla prezto setup also make use of compinit? The completion module can be disabled with |
@berbiche I haven't enabled for i in $(seq 1 10); do /usr/bin/time $SHELL -i -c exit; done
1.13 real 0.68 user 0.40 sys
0.41 real 0.13 user 0.26 sys
0.40 real 0.13 user 0.26 sys
0.41 real 0.13 user 0.27 sys
0.40 real 0.13 user 0.26 sys
0.40 real 0.13 user 0.26 sys
0.40 real 0.13 user 0.26 sys
0.40 real 0.13 user 0.26 sys
0.40 real 0.13 user 0.26 sys
0.40 real 0.13 user 0.26 sys With vanilla prezto I get this: for i in $(seq 1 10); do /usr/bin/time $SHELL -i -c exit; done
0.47 real 0.32 user 0.13 sys
0.10 real 0.05 user 0.04 sys
0.10 real 0.05 user 0.04 sys
0.10 real 0.05 user 0.04 sys
0.10 real 0.04 user 0.04 sys
0.10 real 0.04 user 0.04 sys
0.10 real 0.04 user 0.04 sys
0.10 real 0.05 user 0.04 sys
0.10 real 0.04 user 0.04 sys
0.10 real 0.04 user 0.04 sys again there is a performance hit to generate the zcompdump on the first invocation - but it's much less, and more to the point, subseuquent invocations are much much quicker than what I get with home-manager's prezto configuration. So I believe something is off with home-manager's prezto configuration when using the prezto completion module. I'll try to stury more thoroughly the behaviour of the completion module, and see why it would behave so much slower with the nix config than with the "vanilla" prezto configuration. |
Update: I found a clue! The Still no idea why that option unsetting has such a profound effect when using prezto with home-manager versus the vanilla setup. At least I have a work around now... |
nix-community/home-manager#2255 It's still unclear why this helps but it does: Setting `programs.zsh.prezto.caseSensitive = True` is the key, see issue description for more context.
nix-community/home-manager#2255 It's still unclear why this helps but it does: Setting `programs.zsh.prezto.caseSensitive = True` is the key, see issue description for more context.
Sadly that breaks case-insensitivity, which I find quite useful when using |
Vanilla prezto does not have the performance hit. It's fast either way, but with home manager I get the quite terrible performance hit unless I set Are you seeing the same behaviour? @pinpox |
@axeltlarsson I get this result on my nixos+home-manager configuration:
For some strange reason, when I'm in a nix-shell though, it is much faster. E.g. using
|
@pinpox unless you have changed the shell used by nix-shell, it will always use bash. |
I have changed it
|
@pinpox and I guess you have the completion module enabled, and thus is not able to reproduce the issue - vanilla prezto is not signigifcantly faster with the same set of plugins (whereby "completion" is one of them)? Also, I'm guessing your second invocation experiment through |
@axeltlarsson I'm using this zsh plugins:
For prezto I have set: prezto.pmodules = [ "utility" "editor" "directory" ]; All of them still work after running |
@pinpox could you try adding |
Thank you for your contribution! I marked this issue as stale due to inactivity. If this remains inactive for another 7 days, I will close this issue. Please read the relevant sections below before commenting. If you are the original author of the issue
If you are not the original author of the issue
Memorandum on closing issuesIf you have nothing of substance to add, please refrain from commenting and allow the bot close the issue. Also, don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen--nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort. |
Sorry, I don't have the time right now to test this. If someone want's to take over please do! |
I've encountered this issue and debugged it. As it was mentioned The only reliable workaround is to set If you really want to keep |
Thank you for debugging this, the explanation makes a lot of sense and I get some closure 🙂. |
For me removing |
Ok this is the workaround that does the trick for me (without impacting my UX): .zshrc: # Triger `vcs_info 'prompt'` before loading Prezto.
# We want the first call to this happen before prezto will
# `unsetopt CASE_GLOB` which will have negative effect on the performance.
# Calling this before case sensitive globing makes initial start much faster.
# see: https://github.com/nix-community/home-manager/issues/2255
autoload -Uz vcs_info
vcs_info 'prompt'
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi |
@turboMaCk |
No that had no effect at all. |
See nix-community#2255. This causes a really noticeable slowdown that is quite hard to track down!
See nix-community#2255. This causes a really noticeable slowdown that is quite hard to track down!
This caused me quite a bit of pain, so I made a PR to fix it in |
See nix-community#2255. This causes a really noticeable slowdown that is quite hard to track down!
See nix-community#2255. This causes a really noticeable slowdown that is quite hard to track down!
Is there an existing issue for this?
Issue description
Hi.
I have spent the last few days trying to understand why my zsh startup time become so slow when I converted my from my usual prezto config to using home manager. I went from a startup time measured as such:
of around 0.10 seconds to 0.41 seconds using the same modules and config! 🐌
To make sure I was making a fair comparison, I tried to make a minimal reproducible example by comparing the exact same revision of prezto with the default options - one configured with home manager and the other per prezto's installation instructions.
With default modules I get 0.21 s startup with home manager.
I copied the prezto derivation from my local nix store to my
~/.zprezto
(cp -R /nix/store/shwbywl4c5fj4ivsm628ari4ivayyfwz-zsh-prezto-unstable-2021-06-02/share/zsh-prezto .zprezto
) and ran prezto's setup in~/.zprezto
.I still get 0.21 s as expected (it should be the same configuration, more or less), howerver I noticed that runcoms/zshrc is not sourcing
~/.zprezto/init.zsh
but theinit.zsh
from the nix store, so I changed that:and re-ran the benchmark and then got excellent performance again at 0.10s, what is going on? 🤔
Of course I realise that the init.zsh in the nix store and the init.zsh in
~/.zprezto
will actually load the modules from different locations, from the nix-store's prezto/modules
and from~/.zprezto/modules
respectively. But the contents are identical!Does anybody know what is going on here and has anyone experienced anything similar?
Furthermore, I tried to optimise the config a bit, and if I remove the
completion
module from my home-manager config, I get really good performance again at 0.09s which is identical to what I get with "vanilla" prezto (also without the completion module).It also appears to be the case that the more other modules are loaded, the more the completion module contributes to a slower start up time. I do not see this behaviour, at least as clearly, with a vanilla prezto setup.
Maintainer CC
@anna328p
@pinpox
System information
The text was updated successfully, but these errors were encountered: