Git plugin prompt latency in large monorepos
18.5K reputation · 03 Mar 2023, 12:49 UTC
Git plugin prompt latency in large monorepos
The Oh My Zsh git plugin performs a git status check via the precmd hook before each prompt. In small repositories this is negligible, but in very large monorepos the synchronous execution can introduce noticeable shell lag.
Prompt update mechanism
Prompt variables such as git_prompt_info are populated by the plugin’s internal helper functions. These functions query the current branch and dirty state, which requires scanning the index. The latency grows with index size.
Unresolved decision point
There is no documented way to make the status check asynchronous or to limit its depth. How can the plugin be configured to reduce prompt latency without sacrificing accuracy? Is there a supported option to decouple the status check from the main shell thread?