Repository navigation
Bind autosuggest widgets once per shell and add CI - #8
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After #7 the shell starts in about 0.15 s, but every prompt still paid about 60 ms before it was drawn. zprof inside a 50,000-file git repository shows
_zsh_autosuggest_bind_widgetsas the largest cost per prompt: zsh-autosuggestions re-wraps all ~200 ZLE widgets in aprecmdhook before every prompt. The repository also had no CI, so #7 was merged on local checks only.Changes
ZSH_AUTOSUGGEST_MANUAL_REBIND=1, the option the plugin documents for this cost. The plugin then binds its widgets once, at the first prompt, after all plugins and the theme have defined theirs.setup.sh --yesinstall and a second run as an update in anubuntu:24.04container. The installer exits non-zero when one of its checks fails, including the Cut interactive zsh startup from 2.4 s to 0.17 s #7 checks for the duplicate Oh My Zsh load and lazy nvm.Measurements
Ubuntu 24.04 containers on x1, each a fresh
setup.sh --yesinstall with p10k'sleanconfig and a synthetic git repository with 50,000 committed files (one modified, one untracked). Variants interleaved over four rounds, load 3–6, nocapped. "main ohne Doppel-Laden" ismainbefore #7 with the duplicate Oh My Zsh load removed by hand.zsh -i -c exit, warm (n = 40)zsh -i -c exit, cold¹ (n = 20)zsh -l -i -c exit, warm (n = 20)compinitper start (zprof, median)This PR on its own, A/B in the same container (#7 vs #7 + manual rebind, 5 sessions × 6 prompts): prompt latency 96 → 35 ms (−64 %), time until a typed-ahead command runs 217 → 191 ms.
¹ Cold = zcompdump, p10k and setup caches deleted before each run; page cache warm.
Verification
zle -lL,bindkey) after three prompts compared with and without manual rebind: identical except nine widgets p10k wraps at its first prompt (clear-screen,send-break,overwrite-mode,deactivate-region,vi-replace,visual-mode,visual-line-mode, twoz4h-*). There the p10k wrapper now sits outside the autosuggest wrapper instead of inside; both call through to the original widget.uv pip ins,nvm ls-rem(zsh-completions) andgit chec, aliasgstworks. Onmainbefore Cut interactive zsh startup from 2.4 s to 0.17 s #7, Up arrow and git completion fail because the second Oh My Zsh load rebinds them.gh,uvanduvx: profile start 1256 → 768 ms (−39 %, n = 20). Not measured on Windows.Rollout
Ubuntu/WSL:
devhub update. Windows:irm https://raw.githubusercontent.com/arturict/zsh-setup/main/setup.ps1 | iex.Model/harness: Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code