JanDeDobbeleer / oh-my-posh

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

oh-my-posh init - long time to load (as compared to v2) #2932

Closed leni8ec closed 1 year ago

leni8ec commented 1 year ago

Code of Conduct

What happened?

It takes a very long time to load after upgrading from v2 to v3!

About 2-3 seconds (antivirus disabled)

As I see it, every time you start oh-my-posh - there is an HTTPRequest that takes 1-2 seconds. Why this behavior, if all data is already available locally? How to disable it?

Thank you!


My ps config variants:

  1. oh-my-posh init pwsh | Invoke-Expression
  2. oh-my-posh init pwsh --config "$(scoop prefix oh-my-posh)\themes\agnosterplus.omp.json" | Invoke-Expression

For the oh-my-posh debug - I removed the oh-my-posh init, otherwise the problem does not reproduce, because the HTTPRequest is made exactly at the initiation.

Theme

default, agnosterplus

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

> oh-my-posh debug

Version: 12.1.0

Segments:

ConsoleTitle(true) -   1 ms - oh-my-posh in sampleuser
session(true)  -   0 ms -  sampleuser 
path(true)     -   1 ms -   ~
git(false)     -  54 ms -
root(false)    -   0 ms -
exit(true)     -   1 ms -   
node(false)    -   0 ms -
go(false)      -   0 ms -
python(false)  -   2 ms -
shell(true)    -   0 ms - in oh-my-posh
time(true)     -   0 ms - at 12:47:16

Run duration: 1.0973288s

Cache path: C:\Users\sampleuser\AppData\Local\oh-my-posh

Config path: C:\Users\sampleuser\AppData\Local\oh-my-posh\config.omp.json

Logs:

2022/10/12 12:47:15 debug: Getenv
C:\Users\sampleuser\AppData\Local
2022/10/12 12:47:15 Getenv duration: 0s, args: LOCALAPPDATA
2022/10/12 12:47:15 CachePath duration: 0s, args:
2022/10/12 12:47:15 debug: Getenv

2022/10/12 12:47:15 Getenv duration: 0s, args: POSH_THEME
2022/10/12 12:47:15 debug: Getenv
C:\Users\sampleuser\AppData\Local
2022/10/12 12:47:15 Getenv duration: 0s, args: LOCALAPPDATA
2022/10/12 12:47:15 CachePath duration: 0s, args:
2022/10/12 12:47:15 debug: HTTPRequest
GET /JanDeDobbeleer/oh-my-posh/v12.1.0/themes/default.omp.json HTTP/1.1
Host: raw.githubusercontent.com
User-Agent: Go-http-client/1.1
Accept-Encoding: gzip

2022/10/12 12:47:16 debug: HTTPRequest
{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "background": "p:yellow",
          "foreground": "p:black",
          "leading_diamond": "\ue0b6",
          "properties": {
            "display_host": false
          },
          "style": "diamond",
          "template": " {{ if .SSHSession }}\uf817 {{ end }}{{ .UserName }} ",
          "trailing_diamond": "\ue0b0",
          "type": "session"
        },
        {
          "background": "p:orange",
          "foreground": "p:white",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "home_icon": "~",
            "style": "folder"
          },
          "style": "powerline",
          "template": " \uf74a {{ path .Path .Location }} ",
          "type": "path"
        },
        {
          "background": "p:green",
          "background_templates": [
            "{{ if or (.Working.Changed) (.Staging.Changed) }}p:yellow{{ end }}",
            "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:red{{ end }}",
            "{{ if gt .Ahead 0 }}#49416D{{ end }}",
            "{{ if gt .Behind 0 }}#7A306C{{ end }}"
          ],
          "foreground": "p:black",
          "foreground_templates": [
            "{{ if or (.Working.Changed) (.Staging.Changed) }}p:black{{ end }}",
            "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:white{{ end }}",
            "{{ if gt .Ahead 0 }}p:white{{ end }}"
          ],
          "powerline_symbol": "\ue0b0",
          "properties": {
            "branch_max_length": 25,
            "fetch_status": true,
            "fetch_upstream_icon": true,
            "github_icon": "\uf7a3"
          },
          "style": "powerline",
          "template": " {{ if .UpstreamURL }}{{ url .UpstreamIcon .UpstreamURL }} {{ end }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }} ",
          "type": "git"
        },
        {
          "background": "p:yellow",
          "foreground": "p:white",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "root_icon": "\uf0ad"
          },
          "style": "powerline",
          "template": " \uf0e7 ",
          "type": "root"
        },
        {
          "background": "p:blue",
          "background_templates": [
            "{{ if gt .Code 0 }}p:red{{ end }}"
          ],
          "foreground": "p:white",
          "leading_diamond": "<transparent,background>\ue0b0</>",
          "properties": {
            "always_enabled": true
          },
          "style": "diamond",
          "template": " {{ if gt .Code 0 }}\uf00d{{ else }}\uf00c{{ end }} ",
          "trailing_diamond": "\ue0b4",
          "type": "exit"
        }
      ],
      "type": "prompt"
    },
    {
      "segments": [
        {
          "background": "transparent",
          "foreground": "p:green",
          "properties": {
            "display_mode": "files",
            "fetch_package_manager": false,
            "home_enabled": false
          },
          "style": "plain",
          "template": "\uf898 ",
          "type": "node"
        },
        {
          "background": "transparent",
          "foreground": "p:blue",
          "properties": {
            "fetch_version": false
          },
          "style": "powerline",
          "template": "\ufcd1 ",
          "type": "go"
        },
        {
          "background": "transparent",
          "foreground": "p:yellow",
          "properties": {
            "display_mode": "files",
            "fetch_version": true,
            "fetch_virtual_env": false
          },
          "style": "plain",
          "template": "\ue235 ",
          "type": "python"
        },
        {
          "background": "transparent",
          "foreground": "p:white",
          "style": "plain",
          "template": "in <p:blue><b>{{ .Name }}</b></> ",
          "type": "shell"
        },
        {
          "background": "transparent",
          "foreground": "p:white",
          "style": "plain",
          "template": "at <p:blue><b>{{ .CurrentDate | date \"15:04:05\" }}</b></>",
          "type": "time"
        }
      ],
      "type": "rprompt"
    }
  ],
  "console_title_template": "{{ .Shell }} in {{ .Folder }}",
  "final_space": true,
  "palette": {
    "black": "#262B44",
    "blue": "#4B95E9",
    "green": "#59C9A5",
    "orange": "#F07623",
    "red": "#D81E5B",
    "white": "#E0DEF4",
    "yellow": "#F3AE35"
  },
  "secondary_prompt": {
    "background": "transparent",
    "foreground": "p:black",
    "template": "<p:yellow,transparent>\ue0b6</><,p:yellow> > </><p:yellow,transparent>\ue0b0</> "
  },
  "tooltips": [
    {
      "background": "p:orange",
      "foreground": "p:white",
      "leading_diamond": "\ue0b6",
      "properties": {
        "display_default": true
      },
      "style": "diamond",
      "template": " \ue7ad {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} ",
      "tips": [
        "aws"
      ],
      "trailing_diamond": "\ue0b4",
      "type": "aws"
    },
    {
      "background": "p:blue",
      "foreground": "p:white",
      "leading_diamond": "\ue0b6",
      "style": "diamond",
      "template": " \ufd03 {{ .Name }} ",
      "tips": [
        "az"
      ],
      "trailing_diamond": "\ue0b4",
      "type": "az"
    }
  ],
  "transient_prompt": {
    "background": "transparent",
    "foreground": "p:black",
    "template": "<p:yellow,transparent>\ue0b6</><,p:yellow> {{ .Folder }} </><p:yellow,transparent>\ue0b0</> "
  },
  "version": 2
}

2022/10/12 12:47:16 HTTPRequest duration: 1.0037597s, args: https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v12.1.0/themes/default.omp.json
2022/10/12 12:47:16 downloadConfig duration: 1.0043072s, args: https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v12.1.0/themes/default.omp.json
2022/10/12 12:47:16 debug: Shell
process name: oh-my-posh.exe
2022/10/12 12:47:16 Shell duration: 20.839ms, args:
2022/10/12 12:47:16 resolveConfigPath duration: 1.0251462s, args:
2022/10/12 12:47:16 Init duration: 1.0331456s, args:
2022/10/12 12:47:16 Flags duration: 0s, args:
2022/10/12 12:47:16 config.loadConfig duration: 1.3102ms, args:
2022/10/12 12:47:16 Flags duration: 0s, args:
2022/10/12 12:47:16 debug: Getenv

2022/10/12 12:47:16 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/10/12 12:47:16 WindowsRegistryKeyValue duration: 0s, args: HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 debug: WindowsRegistryKeyValue
ColorizationColor(DWORD): 0xC429A5CC
2022/10/12 12:47:16 Root duration: 0s, args:
2022/10/12 12:47:16 Shell duration: 0s, args:
2022/10/12 12:47:16 ErrorCode duration: 0s, args:
2022/10/12 12:47:16 IsWsl duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 528.1µs, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 debug: User
sampleuser
2022/10/12 12:47:16 User duration: 0s, args:
2022/10/12 12:47:16 debug: Host
PC-sampleuser
2022/10/12 12:47:16 Host duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 TemplateCache duration: 528.1µs, args:
2022/10/12 12:47:16 Flags duration: 0s, args:
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 debug: Getenv

2022/10/12 12:47:16 Getenv duration: 0s, args: SSH_CONNECTION
2022/10/12 12:47:16 debug: Getenv

2022/10/12 12:47:16 Getenv duration: 0s, args: SSH_CLIENT
2022/10/12 12:47:16 TemplateCache duration: 0s, args:
2022/10/12 12:47:16 TemplateCache duration: 0s, args:
2022/10/12 12:47:16 Shell duration: 0s, args:
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 Shell duration: 0s, args:
2022/10/12 12:47:16 Shell duration: 0s, args:
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 PathSeparator duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 PathSeparator duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 PathSeparator duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 PathSeparator duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 PathSeparator duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 IsWsl duration: 0s, args:
2022/10/12 12:47:16 StackCount duration: 0s, args:
2022/10/12 12:47:16 DirIsWritable duration: 0s, args:
2022/10/12 12:47:16 TemplateCache duration: 0s, args:
2022/10/12 12:47:16 TemplateCache duration: 0s, args:
2022/10/12 12:47:16 Shell duration: 0s, args:
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 debug: CommandPath
C:\Scoop\apps\git\current\cmd\git.exe
2022/10/12 12:47:16 CommandPath duration: 3.3295ms, args: git.exe
2022/10/12 12:47:16 HasCommand duration: 3.3295ms, args: git.exe
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 error: HasParentFilePath
CreateFile C:\.git: The system cannot find the file specified.
2022/10/12 12:47:16 HasParentFilePath duration: 573.6µs, args: .git
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 error: RunCommand
cmd.Run() failed
2022/10/12 12:47:16 debug: RunCommand
fatal: not a git repository (or any of the parent directories): .git

2022/10/12 12:47:16 RunCommand duration: 50.4133ms, args: git.exe -C C:\Users\sampleuser --no-optional-locks -c core.quotepath=false -c color.status=false rev-parse --is-bare-repository
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 Root duration: 0s, args:
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 ErrorCode duration: 0s, args:
2022/10/12 12:47:16 TemplateCache duration: 0s, args:
2022/10/12 12:47:16 TemplateCache duration: 0s, args:
2022/10/12 12:47:16 Shell duration: 0s, args:
2022/10/12 12:47:16 TemplateCache duration: 0s, args:
2022/10/12 12:47:16 Flags duration: 0s, args:
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 505µs, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 PathSeparator duration: 0s, args:
2022/10/12 12:47:16 debug: HasFiles
false
2022/10/12 12:47:16 HasFiles duration: 583.7µs, args: *.py
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 PathSeparator duration: 0s, args:
2022/10/12 12:47:16 debug: HasFiles
false
2022/10/12 12:47:16 HasFiles duration: 1.1743ms, args: *.ipynb
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 PathSeparator duration: 0s, args:
2022/10/12 12:47:16 debug: HasFiles
false
2022/10/12 12:47:16 HasFiles duration: 0s, args: pyproject.toml
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 PathSeparator duration: 0s, args:
2022/10/12 12:47:16 debug: HasFiles
false
2022/10/12 12:47:16 HasFiles duration: 0s, args: venv.bak
2022/10/12 12:47:16 debug: HasFolder
false
2022/10/12 12:47:16 HasFolder duration: 0s, args: .venv
2022/10/12 12:47:16 debug: HasFolder
false
2022/10/12 12:47:16 HasFolder duration: 506.2µs, args: venv
2022/10/12 12:47:16 debug: HasFolder
false
2022/10/12 12:47:16 HasFolder duration: 77µs, args: virtualenv
2022/10/12 12:47:16 debug: HasFolder
false
2022/10/12 12:47:16 HasFolder duration: 0s, args: env
2022/10/12 12:47:16 debug: HasFolder
false
2022/10/12 12:47:16 HasFolder duration: 0s, args: venv-win
2022/10/12 12:47:16 debug: HasFolder
false
2022/10/12 12:47:16 HasFolder duration: 0s, args: pyenv-win
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 Shell duration: 0s, args:
2022/10/12 12:47:16 Flags duration: 0s, args:
2022/10/12 12:47:16 TemplateCache duration: 0s, args:
2022/10/12 12:47:16 TemplateCache duration: 0s, args:
2022/10/12 12:47:16 Shell duration: 0s, args:
2022/10/12 12:47:16 debug: Pwd
C:\Users\sampleuser
2022/10/12 12:47:16 Pwd duration: 0s, args:
2022/10/12 12:47:16 debug: Home
C:\Users\sampleuser
2022/10/12 12:47:16 GOOS duration: 0s, args:
2022/10/12 12:47:16 TemplateCache duration: 0s, args:
2022/10/12 12:47:16 TemplateCache duration: 0s, args:
2022/10/12 12:47:16 Shell duration: 0s, args:
2022/10/12 12:47:16 debug: Getenv
C:\Users\sampleuser\AppData\Local
2022/10/12 12:47:16 Getenv duration: 0s, args: LOCALAPPDATA
2022/10/12 12:47:16 CachePath duration: 0s, args:
2022/10/12 12:47:16 Flags duration: 0s, args:
leni8ec commented 1 year ago

Wget for same file

> wget https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v12.1.0/themes/default.omp.json
--2022-10-12 13:04:39--  https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v12.1.0/themes/default.omp.json
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.109.133, 185.199.108.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5732 (5,6K) [text/plain]
Saving to: 'default.omp.json'

default.omp.json              100%[=================================================>]   5,60K  --.-KB/s    in 0,005s

2022-10-12 13:04:40 (1,03 MB/s) - 'default.omp.json' saved [5732/5732]
JanDeDobbeleer commented 1 year ago

@leni8ec this is indicated in the docs. When not specifying a theme it will download the default theme. As we don't know if you have this locally or where it would reside, we download on init. To resolve, download that config locally and reference it using the --config flag. More on that here.

leni8ec commented 1 year ago

@JanDeDobbeleer, I gave an example that even if you load the theme locally - there is still this delay:

oh-my-posh init pwsh --config "$(scoop prefix oh-my-posh)\themes\agnosterplus.omp.json" | Invoke-Expression

But using oh-my-posh debug - I can not trace the delay, because oh-my-posh is already initialized at this point.

leni8ec commented 1 year ago

It is also not clear why there is such a long delay, when the same wget, loads the same file - instantly.

leni8ec commented 1 year ago

It is a pity we did not understand the essence of the problem, I will stay on the second version for now, it works well.

But still I will be glad to help in providing any debug data from my side.

JanDeDobbeleer commented 1 year ago

9/10 the path you provided wasn't valid (debug will also show that when you invoke using the same --config flag). As for wget vs go https request, yes there can be a difference here. The good news is that fro the default, it's now shipped inside the executable so there's no longer a need to download the config on init.

leni8ec commented 1 year ago

@JanDeDobbeleer, Thank you for paying attention, though.

  1. The configuration path is the true image

  2. But I have detected some pattern in the delay, when using $(scoop prefix oh-my-posh) image

  3. However, 800ms is still a lot, compared to the implementation in v2 (where this message does not pop up at all, because the download is faster than 500ms, which is the threshold for this warning) image

JanDeDobbeleer commented 1 year ago

@leni8ec that's one for the PowerShell team. Things ate notoriously slow during startup as init does less than what the prompt does and the command doesn't take 800ms to finish when you time it.

leni8ec commented 1 year ago

@JanDeDobbeleer, With the command sleep 1 (before all) - I checked that my console starts up in about 200-250ms.

And oh-my-posh adds 600-650 ms of overhead!

Again, the previous version (v2 - via PowerShell module) did not have this problem and the delay was minimal. If you mean that this is a "feature" of this version oh-my-posh v3 and is not a issue, then I understand you and I will not bother you anymore. I will use the previous release as long as it is possible.

And thanks again for the great utility!

JanDeDobbeleer commented 1 year ago

@leni8ec once again, this has nothing to do with oh-my-posh but PowerShell starting slow in Core. If you use the same profile and oh-my-posh version in PowerShell 5, it's much, much faster.

leni8ec commented 1 year ago

@JanDeDobbeleer, PowerShell 5 results.

Using oh-my-posh - adding 700-900 ms overhead! Local theme with absolute path. Which is even more than in the PS Core version.

879ms = profile: ~150ms + oh-my-posh: ~700ms

image

JanDeDobbeleer commented 1 year ago

@leni8ec you should time the individual oh-my-posh commands without Invoke-Expression. Using Measure-Command. If those run swiftly, it's PowerShell who's slow, not oh-my-posh. And if oh-my-posh is slow, oh-my-posh debug should show the same.

JanDeDobbeleer commented 1 year ago

@leni8ec I'll let you define who's actually slow here, but it sure isn't us:

image

If you don't like PowerShell's speed when it comes to using executables during init (or even Invoke-Expression), that's something to pick up with them.

leni8ec commented 1 year ago

Thank you!

Yes, when using this tool - it is clear that the delay is really not critical. image

However, in fact - I still can not use this tool, due to the delay in its initialization in PS :(

JanDeDobbeleer commented 1 year ago

@leni8ec have a look at this post.

github-actions[bot] commented 9 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.