commit 363ab2e3c855b04e47d8aab8a8be3d88d7f61ce5
parent 5759b42ed42c79b6e65262908dce604aa85b32da
Author: Chris Bracken <chris@bracken.jp>
Date: Sun, 7 Jun 2026 08:05:50 +0900
zsh: compile zcompdump to bytecode
Adds a few ms once a day, but saves a few ms ever time we start up since
the bytecode can be mmaped back into memory instead of having to
re-parse the text dump each time.
Diffstat:
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc
@@ -39,6 +39,12 @@ else
compinit
fi
+# Compile .zcompdump to bytecode so subsequent shells load it via mmap instead
+# of re-parsing the text dump.
+if [[ -s $ZDOTDIR/.zcompdump && (! -s $ZDOTDIR/.zcompdump.zwc || $ZDOTDIR/.zcompdump -nt $ZDOTDIR/.zcompdump.zwc) ]]; then
+ zcompile -R -- $ZDOTDIR/.zcompdump.zwc $ZDOTDIR/.zcompdump
+fi
+
# Current VCS branch (for prompt).
vcs_branch() {
# If in a jj repo, indicate that we're in a repo.
diff --git a/.gitignore b/.gitignore
@@ -52,6 +52,7 @@
# zsh cached data.
.config/zsh/.zcompdump
+.config/zsh/.zcompdump.zwc
.config/zsh/.zcompdumps/
.config/zsh/.zsh_history
.config/zsh/.zsh_sessions/