oh-my-posh: Performance: Command Execution Slow in Git Repositories
Prerequisites
- I have read and understood the
CONTRIBUTINGguide - I have looked for duplicate issues before submitting this one
Description
Hello. The program runs very smothly(almost instantaneously) when outside a git repository, but as soon as I enter a git repository(ir doesn’t matter how big or small it is) it gets slow taking more than 300ms to execute on average wich is noticible. An example can be seen in the picture below:

I have followed the steps described in the offitial page for the installation. I’ve been browsing the internet trying to look for a solution or verifying if this was normal or not but couldn’t find an answer. Also, on the youtube videos I visited seemed didn’t seem to be any kind of slowdowns when getting in a git repository.
I want to know if this is normal and if it is not I’d like to know how I could try to fix it. Thanks in advance!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 18 (12 by maintainers)
@amoldeshpande there is indeed a newer version since that version (we moved to 1.16). I created a change that made quite the impact on my machine (went from 1400ms to 300ms).
@JanDeDobbeleer I tested and did some changes, tell me what you think
https://github.com/JanDeDobbeleer/oh-my-posh/pull/878
@JanDeDobbeleer I did a small try be replacing the call to
g.getGitCommandOutput("remote", "get-url", upstream)by reading the .git config file directly and it saves 75ms on my side(on the ohmyposh repo). Going from ±280 ms to 205ms. Could be already an improvement.I have to check if it works with worktree.
https://github.com/lnu/oh-my-posh/tree/perf/segment_git
just measuring the two from powershell, the first takes 20-30ms while the second takes 50-52 ms. adding 40ms
gooverhead for a single process spawning still doesn’t get me to 90ms vs 270ms