Closed leni8ec closed 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]
@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.
@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.
It is also not clear why there is such a long delay, when the same wget
, loads the same file - instantly.
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.
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.
@JanDeDobbeleer, Thank you for paying attention, though.
The configuration path is the true
But I have detected some pattern in the delay, when using $(scoop prefix oh-my-posh)
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)
@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.
@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!
@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.
@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
@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.
@leni8ec I'll let you define who's actually slow here, but it sure isn't us:
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.
Thank you!
Yes, when using this tool - it is clear that the delay is really not critical.
However, in fact - I still can not use this tool, due to the delay in its initialization in PS :(
@leni8ec have a look at this post.
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.
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:
oh-my-posh init pwsh | Invoke-Expression
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 theoh-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