4

PowerShell 启动慢 - V2EX

 2 years ago
source link: https://www.v2ex.com/t/845128
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  PowerShell

PowerShell 启动慢

  CUPAIR · 18 小时 5 分钟前 · 1254 次点击

pwsh:powershell7.15; powershell: powershellv1.0,不知道啥版本,就 win11 自带的 :

  • 配置oh-my-posh+posh-git两个模块,启动速度 1000ms-1100ms
  • $profile内容全部注释掉,启动速度,启动速度 500ms
  • pwsh -noprofile有明显停顿感(但感觉应该没 500ms 这么夸张了)
  • powershell -noprofile几乎没有延迟

这个延迟太高了,不知道有什么优化方法没,stackoverflow上提到.net 框架升级,感觉不怎么靠谱,因为powershell -noprofile这个指令基本没啥延迟,所以感觉应该是配置文件优化的问题,有 v 友懂如何优化吗

17 条回复    2022-04-06 16:38:57 +08:00

ersic

ersic      17 小时 28 分钟前   ❤️ 3

我之前用 oh-my-posh+posh ,配置了一大堆东西,感觉是慢了,现在在用 https://github.com/starship/starship

hope4tomorrow

hope4tomorrow      16 小时 36 分钟前

macos ,之前用 iterm2 + zsh ,用了 oh-my-zsh 和各种插件,启动 1s+,忍受不了,随即换成 wezterm, 目前丝滑到极致。。。

Tumblr

Tumblr      16 小时 28 分钟前

这让我想到了当年比拼 Windows 开机速度的时候,这个“我开机 10 秒”,那个“我开机 8 秒”,一定要争做那个最快的男人……

nightwitch

nightwitch      16 小时 21 分钟前

没什么优化的,powershell 就是很慢。
如果对速度有要求建议自己写点 alias 就行了,主题之类的会很慢

creanme

creanme      16 小时 20 分钟前

我 pwshl 冷启动花了至少 6 秒。。。。真的离谱。再次启动就快多了,估计 500 多毫秒。

ncepuzs

ncepuzs      13 小时 46 分钟前

@ersic 同样是从 oh my posh 转向 starship prompt

CUPAIR

CUPAIR      13 小时 2 分钟前

@ersic 换了一下,启动速度 700-800ms ,感觉延迟还是高,但 starship 默认的主题挺简洁的,好看

tuutoo

tuutoo      12 小时 43 分钟前

我现在也在用 oh-my-posh+posh 可能电脑配置也有点关系 同样配置单位电脑要 2000ms - 4000ms 不等,家里的 400ms 左右。
也是慢的不能忍受,看了下二楼这个好像不错,准备试一下。

ersic

ersic      12 小时 18 分钟前

@CUPAIR 我大概也是这个延迟,感觉没法再优化了。

h404bi

h404bi      11 小时 40 分钟前

就是很慢,我的配置文件加载基本 1500ms 以上,习惯了。

356693212

356693212      11 小时 35 分钟前

Loading personal and system profiles took 1798ms. 你可以二分法测试。谁知道你有什么配置和插件啊。

CokeMine

CokeMine      11 小时 30 分钟前

pwsh -noprofile 有的时候能卡到好几十秒才能加载出来(有时好几十秒,有时几秒,有时很快,5.x 7.x 版本都这样)
加上 -noprofile 了肯定不是一些插件的问题
网上搜了一些 用什么 ngen.exe 什么的方法都无效

skinny

skinny      11 小时 28 分钟前

试试加两个环境变量然后重启:
POWERSHELL_TELEMETRY_OPTOUT=1
POWERSHELL_UPDATECHECK=Off

再慢就没有办法了。

ecoo

ecoo      11 小时 21 分钟前

@ncepuzs #6 我刚刚也换了,速度虽然差不多,但是真好看

duke807

duke807      11 小时 16 分钟前

我想知道怎麼測試啓動速度,我的 xfce 桌面,ctrl + alt + t 快捷鍵打開 shell 窗口太快了,完全沒法測速度啊。。。

Lemeng

Lemeng      11 小时 6 分钟前

习惯就好,也没啥大问题

beetlerx

beetlerx      10 小时 42 分钟前

一直用 msys2 + hyper ( https://hyper.is/) + oh-my-zsh

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK