From 0da79193394f92169e0150cbd219746ec353faf9 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 7 Sep 2026 01:14:56 -0700 Subject: [PATCH] perf(init): skip the compdump lock and zrecompile when the .zwc is fresh (#14064) --- oh-my-zsh.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index e7a9254af..00e21679d 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -148,7 +148,9 @@ fi unset zcompdump_revision zcompdump_fpath zcompdump_refresh # zcompile the completion dump file if the .zwc is older or missing. -if command mkdir "${ZSH_COMPDUMP}.lock" 2>/dev/null; then +# Test that first so the lock directory and zrecompile are skipped when it's fresh. +if [[ ! "${ZSH_COMPDUMP}.zwc" -nt "$ZSH_COMPDUMP" ]] \ + && command mkdir "${ZSH_COMPDUMP}.lock" 2>/dev/null; then zrecompile -q -p "$ZSH_COMPDUMP" command rm -rf "$ZSH_COMPDUMP.zwc.old" "${ZSH_COMPDUMP}.lock" fi