Skip to content

Make zsh faster ~ Yesterday Once More ~#237

Merged
kachick merged 3 commits intomainfrom
faster-zsh
Aug 2, 2023
Merged

Make zsh faster ~ Yesterday Once More ~#237
kachick merged 3 commits intomainfrom
faster-zsh

Conversation

@kachick
Copy link
Copy Markdown
Owner

@kachick kachick commented Aug 2, 2023

Fixes #222
Updates kachick/times_kachick#184
May again #155

Comment thread home-manager/zsh.nix Outdated
local -r dump_dir="${config.xdg.cacheHome}/zsh"
local -r dump_path="$dump_dir/zcompdump-$ZSH_VERSION"

if ${lib.getExe pkgs.fd} --quiet --changed-within 6hours "$dump_path"; then
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fd is much slow for this purpose 🙄

@kachick
Copy link
Copy Markdown
Owner Author

kachick commented Aug 2, 2023

180~250ms => 60ms 😂

@kachick
Copy link
Copy Markdown
Owner Author

kachick commented Aug 2, 2023

Extracted the docker completion error in first time has been extracted as #236

@kachick kachick changed the title Struggle with zsh many times again Make zsh faster again ~ Yesterday Once More ~ Aug 2, 2023
Comment thread home-manager/zsh.nix
# https://github.com/nix-community/home-manager/blob/8c731978f0916b9a904d67a0e53744ceff47882c/modules/programs/zsh.nix#L368-L372
# The default is "autoload -U compinit && compinit", I can not accept the path and speed
initExtraBeforeCompInit = ''
_elapsed_seconds_for() {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much useful 🤔

Comment thread home-manager/zsh.nix
compinit -C -d "$dump_path"
else
mkdir -p "$dump_dir"
compinit -d "$dump_path"
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without cache as here, still taking 160~180ms

@kachick kachick marked this pull request as ready for review August 2, 2023 08:04
@kachick kachick merged commit f146a4f into main Aug 2, 2023
@kachick kachick deleted the faster-zsh branch August 2, 2023 08:04
@kachick kachick changed the title Make zsh faster again ~ Yesterday Once More ~ Make zsh faster ~ Yesterday Once More ~ Aug 2, 2023
kachick added a commit that referenced this pull request Aug 2, 2023
@kachick
Copy link
Copy Markdown
Owner Author

kachick commented Aug 2, 2023

Almost 50~60 ms for all bash, zsh, fish in WSL2

Almost 120~170ms in my macbook pro 2018 model 🤮

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.

Slow zsh with the completion?

1 participant