JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
16.79k stars 2.35k forks source link

OhMyPosh is super slow after migration from PowerShell module #2265

Closed mwasowski closed 2 years ago

mwasowski commented 2 years ago

Code of Conduct

What happened?

Hi,

After migrating from PowerShell module as recommended here I experience significant drop in performance of the shell.

Below you can see comparison between the same action (just pressing enter, not in repository, just home folder) happening before and after the transition to the new version.

Old: WindowsTerminal_old New: WindowsTerminal_new

Any ideas?

Kind regards, Michal

Theme

{ "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "blocks": [ { "alignment": "left", "newline": true, "type": "prompt" }, { "alignment": "left", "newline": true, "segments": [ { "background": "#d3d7cf", "foreground": "#000000", "style": "diamond", "template": " {{ if .WSL }}WSL at {{ end }}{{.Icon}} ", "type": "os" }, { "background": "#3465a4", "foreground": "#e4e4e4", "powerline_symbol": "\ue0b0", "properties": { "home_icon": "\uf7db", "style": "full" }, "style": "powerline", "template": "{{if eq .PWD \"~\" }} {{ path .Path .Location }} {{else}} \uf07c {{ path .Path .Location }} {{end}}", "type": "path" }, { "background": "#4e9a06", "background_templates": [ "{{ if or (.Working.Changed) (.Staging.Changed) }}#c4a000{{ end }}", "{{ if and (gt .Ahead 0) (gt .Behind 0) }}#f26d50{{ end }}", "{{ if gt .Ahead 0 }}#4e9a06{{ end }}", "{{ if gt .Behind 0 }}#89d1dc{{ end }}" ], "foreground": "#000000", "powerline_symbol": "\ue0b0", "properties": { "branch_icon": "\uf126 ", "fetch_stash_count": true, "fetch_status": true, "fetch_upstream_icon": true }, "style": "powerline", "template": "{{ if( .UpstreamIcon ) }} {{ url .UpstreamIcon .UpstreamURL }} {{ end }}{{ .HEAD }} {{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }} {{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }} {{ end }}{{ if gt .StashCount 0}}\uf692 {{ .StashCount }} {{ end }}{{ if gt .WorktreeCount 0}} \uf1bb {{ .WorktreeCount }} {{ end }}", "type": "git" } ], "type": "prompt" }, { "alignment": "right", "segments": [ { "background": "#689f63", "foreground": "#ffffff", "leading_diamond": "<background,parentBackground>\ue0b2</>", "properties": { "fetch_version": true }, "style": "diamond", "template": " {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} \uf898 ", "type": "node" }, { "background": "#00acd7", "foreground": "#111111", "leading_diamond": "<background,parentBackground>\ue0b2</>", "properties": { "fetch_version": true }, "style": "diamond", "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue627 ", "type": "go" }, { "background": "#FFDE57", "foreground": "#111111", "leading_diamond": "<background,parentBackground>\ue0b2</>", "properties": { "display_mode": "files", "fetch_version": true, "fetch_virtual_env": false }, "style": "diamond", "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }} {{ end }}{{ .Full }}{{ end }} \ue235 ", "type": "python" }, { "background": "#FEAC19", "foreground": "#ffffff", "leading_diamond": "<background,parentBackground>\ue0b2</>", "properties": { "display_mode": "files", "fetch_version": false }, "style": "diamond", "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \uf0e7 ", "type": "azfunc" }, { "background_templates": [ "{{if contains \"default\" .Profile}}#FFA400{{end}}", "{{if contains \"Michał\" .Profile}}#f1184c{{end}}" ], "foreground": "#ffffff", "leading_diamond": "<background,parentBackground>\ue0b2</>", "properties": { "display_default": false }, "style": "diamond", "template": " {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} \ue7ad ", "type": "aws" }, { "background": "#000000", "background_templates": [ "{{ if gt .Code 0 }}#cc2222{{ end }}" ], "foreground": "#d3d7cf", "leading_diamond": "<background,parentBackground>\ue0b2</>", "properties": { "always_enabled": false, "display_exit_code": true }, "style": "diamond", "template": " {{ if gt .Code 0 }}\uf00d {{ .Meaning }}{{ else }}\uf42e{{ end }} ", "type": "exit" }, { "background": "#ffff66", "foreground": "#111111", "leading_diamond": "<background,parentBackground>\ue0b2</>", "style": "diamond", "template": " \uf0ad ", "type": "root" }, { "background": "#c4a000", "foreground": "#000000", "leading_diamond": "<background,parentBackground>\ue0b2</>", "properties": { "always_enabled": false, "threshold": 100 }, "style": "diamond", "template": " {{ .FormattedMs }} \uf252 ", "type": "executiontime" }, { "background": "#d3d7cf", "foreground": "#000000", "leading_diamond": "<background,parentBackground>\ue0b2</>", "style": "diamond", "template": " {{ .CurrentDate | date .Format }} \uf017 ", "type": "time" } ], "type": "prompt" }, { "alignment": "left", "newline": true, "segments": [ { "foreground": "#007ACC", "style": "plain", "template": "\u276f", "type": "text" } ], "type": "prompt" } ], "console_title_template": "{{ .Shell }} in {{ .Folder }}", "final_space": true, "transient_prompt": { "background": "transparent", "foreground": "#007ACC", "template": "\u276f " }, "version": 2 }

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Version: 7.82.1

Segments:

ConsoleTitle(true)   -   0 ms - pwsh in ~
os(true)             -   0 ms -  
path(true)           -   0 ms -  
git(false)           -  13 ms -
node(false)          -   0 ms -
go(false)            -   0 ms -
python(false)        -   1 ms -
azfunc(false)        -   0 ms -
aws(false)           -   0 ms -
exit(false)          -   0 ms -
root(false)          -   0 ms -
executiontime(false) -   0 ms -
time(true)           -   0 ms -  17:18:16 
text(true)           -   0 ms - ❯

Run duration: 28.6686ms

Cache path: C:\Users\[*]\AppData\Local\oh-my-posh

Config path: C:\Users\[*]\.oh-my-posh\powerlevel10k_rainbowed.omp.json

Logs:

2022/05/13 17:18:16 debug: Getenv
C:\Users\[*]\AppData\Local
2022/05/13 17:18:16 Getenv duration: 197.8µs, args: LOCALAPPDATA
2022/05/13 17:18:16 CachePath duration: 246.6µs, args:
2022/05/13 17:18:16 debug: Getenv
C:\Users\[*]\.oh-my-posh\powerlevel10k_rainbowed.omp.json
2022/05/13 17:18:16 Getenv duration: 0s, args: POSH_THEME
2022/05/13 17:18:16 Shell duration: 9.647ms, args:
2022/05/13 17:18:16 resolveConfigPath duration: 9.647ms, args:
2022/05/13 17:18:16 Init duration: 9.8936ms, args:
2022/05/13 17:18:16 Flags duration: 0s, args:
2022/05/13 17:18:16 config.loadConfig duration: 2.548ms, args:
2022/05/13 17:18:16 Flags duration: 0s, args:
2022/05/13 17:18:16 debug: Getenv

2022/05/13 17:18:16 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/05/13 17:18:16 Root duration: 0s, args:
2022/05/13 17:18:16 Shell duration: 0s, args:
2022/05/13 17:18:16 ErrorCode duration: 0s, args:
2022/05/13 17:18:16 IsWsl duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 PathSeparator duration: 0s, args:
2022/05/13 17:18:16 PathSeparator duration: 0s, args:
2022/05/13 17:18:16 debug: User
[*]
2022/05/13 17:18:16 User duration: 0s, args:
2022/05/13 17:18:16 debug: Host
PL-LAP-565-WIN
2022/05/13 17:18:16 Host duration: 0s, args:
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 TemplateCache duration: 0s, args:
2022/05/13 17:18:16 Flags duration: 0s, args:
2022/05/13 17:18:16 Flags duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 TemplateCache duration: 0s, args:
2022/05/13 17:18:16 TemplateCache duration: 0s, args:
2022/05/13 17:18:16 Shell duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 Flags duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 PathSeparator duration: 0s, args:
2022/05/13 17:18:16 PathSeparator duration: 0s, args:
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 IsWsl duration: 0s, args:
2022/05/13 17:18:16 StackCount duration: 0s, args:
2022/05/13 17:18:16 TemplateCache duration: 0s, args:
2022/05/13 17:18:16 TemplateCache duration: 0s, args:
2022/05/13 17:18:16 Shell duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 HasCommand duration: 13.3365ms, args: git.exe
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 error: HasParentFilePath
CreateFile C:\.git: The system cannot find the file specified.
2022/05/13 17:18:16 HasParentFilePath duration: 513.7µs, args: .git
2022/05/13 17:18:16 Flags duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 PathSeparator duration: 0s, args:
2022/05/13 17:18:16 debug: HasFiles
false
2022/05/13 17:18:16 HasFiles duration: 515.1µs, args: *.py
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 PathSeparator duration: 0s, args:
2022/05/13 17:18:16 debug: HasFiles
false
2022/05/13 17:18:16 HasFiles duration: 0s, args: *.ipynb
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 505.1µs, args:
2022/05/13 17:18:16 PathSeparator duration: 0s, args:
2022/05/13 17:18:16 debug: HasFiles
false
2022/05/13 17:18:16 HasFiles duration: 519.4µs, args: pyproject.toml
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 PathSeparator duration: 0s, args:
2022/05/13 17:18:16 debug: HasFiles
false
2022/05/13 17:18:16 HasFiles duration: 0s, args: venv.bak
2022/05/13 17:18:16 debug: HasFolder
false
2022/05/13 17:18:16 HasFolder duration: 0s, args: .venv
2022/05/13 17:18:16 debug: HasFolder
false
2022/05/13 17:18:16 HasFolder duration: 0s, args: venv
2022/05/13 17:18:16 debug: HasFolder
false
2022/05/13 17:18:16 HasFolder duration: 0s, args: virtualenv
2022/05/13 17:18:16 debug: HasFolder
false
2022/05/13 17:18:16 HasFolder duration: 0s, args: env
2022/05/13 17:18:16 debug: HasFolder
false
2022/05/13 17:18:16 HasFolder duration: 0s, args: venv-win
2022/05/13 17:18:16 debug: HasFolder
false
2022/05/13 17:18:16 HasFolder duration: 0s, args: pyenv-win
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 debug: Getenv

2022/05/13 17:18:16 Getenv duration: 0s, args: AWS_VAULT
2022/05/13 17:18:16 debug: Getenv

2022/05/13 17:18:16 Getenv duration: 0s, args: AWS_PROFILE
2022/05/13 17:18:16 debug: Getenv

2022/05/13 17:18:16 Getenv duration: 0s, args: AWS_REGION
2022/05/13 17:18:16 debug: Getenv

2022/05/13 17:18:16 Getenv duration: 0s, args: AWS_DEFAULT_REGION
2022/05/13 17:18:16 debug: Getenv

2022/05/13 17:18:16 Getenv duration: 0s, args: AWS_CONFIG_FILE
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 error: FileContent
open C:\Users\[*]/.aws/config: The system cannot find the file specified.
2022/05/13 17:18:16 FileContent duration: 0s, args: C:\Users\[*]/.aws/config
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 ErrorCode duration: 0s, args:
2022/05/13 17:18:16 ErrorCode duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 Root duration: 518.6µs, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 ExecutionTime duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 TemplateCache duration: 0s, args:
2022/05/13 17:18:16 TemplateCache duration: 0s, args:
2022/05/13 17:18:16 Shell duration: 0s, args:
2022/05/13 17:18:16 Flags duration: 0s, args:
2022/05/13 17:18:16 debug: Pwd
C:\Users\[*]
2022/05/13 17:18:16 Pwd duration: 0s, args:
2022/05/13 17:18:16 debug: Home
C:\Users\[*]
2022/05/13 17:18:16 GOOS duration: 0s, args:
2022/05/13 17:18:16 TemplateCache duration: 0s, args:
2022/05/13 17:18:16 TemplateCache duration: 0s, args:
2022/05/13 17:18:16 Shell duration: 0s, args:
2022/05/13 17:18:16 debug: Getenv
C:\Users\[*]\AppData\Local
2022/05/13 17:18:16 Getenv duration: 0s, args: LOCALAPPDATA
2022/05/13 17:18:16 CachePath duration: 85.6µs, args:
2022/05/13 17:18:16 Flags duration: 0s, args:
JanDeDobbeleer commented 2 years ago

@mwasowski yup, looking at that oh-my-posh only takes 29ms, it's going to be either Defender/virus scanner which blocks the execution (so add an exclusion) or posh-git which is set to true and takes a bit of time before printing the shell.

mwasowski commented 2 years ago

@JanDeDobbeleer Hm..I'll try to investigate the first part. As for the second, it's the same setup on both, yes, with posh-git, but also not in a repository folder.

mwasowski commented 2 years ago

@JanDeDobbeleer Ok, I added oh-my-posh.exe to Virus & threat protection exclusions and it works as before. Thanks for the suggestion. I think it would make sense to add this to the migration FAQ in the docs.

For anyone wondering how to add file or folder to exclusion list, look at this article from Microsoft.

JanDeDobbeleer commented 2 years ago

@mwasowski it's listed in the installation guide, but I agree, let me add it!

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.