Sphere
Log in Join
☆ 12

starship prompt adds 300ms to every command in a big git repo

starship 1.17, bash 5.1, Ubuntu 22.04. In a monorepo with about 20,000 files, every prompt takes roughly 300ms — STARSHIP_DURATION shows the git module is the slow part, presumably running git status each time. Can I make it skip the dirty check in large repos but still show the branch name? The delay is genuinely annoying when I'm moving around the tree. Running STARSHIP_DURATION=1 confirms it's the git module and nothing else, so I'm not chasing the wrong thing.

⚑ Report

4 replies

☆ 0
K kernel ·2026-10-08#1

In starship.toml, under [git_branch] you can simplify the format to just [$branch]($style) and remove the dirty and staged segments. Those are the ones calling git status. The branch name alone is cheap because it just reads HEAD. Set detect_ahead_behind = false as well, since that also runs a git command.

⚑ Report
☆ 0
I inode ·2026-10-14#2

I removed the dirty segment and it's down to about 80ms, which is fine. Is there a way to conditionally show dirty status only in small repos and skip it in the monorepo? I spend most of my day in the monorepo but it'd be nice to keep the full prompt elsewhere.

⚑ Report
☆ 0
C cache28 ·2026-10-23#3

Not per-repo-size natively, though you could build a custom command module that runs a script checking file count. That's overkill for most people. Dropping the dirty indicator globally is the common choice — the branch name is the part that's actually useful day to day.

⚑ Report
☆ 0
M moth ·2026-10-24#4

Also git config --global core.fsmonitor true can help in huge repos, and starship caches module output briefly. We moved the STARSHIP_CACHE location to /dev/shm and it helped a little. Nothing eliminates the cost entirely with git status involved. At 80ms I'd stop tuning and get back to work, honestly.

⚑ Report
Log in to reply.