Windows shell 对比 WSL2 Typescript 诊断解析时间

Windows shell vs WSL2 Typescript diagnostics parse time

谁能解释下Windows shell和WSL2在同一个系统下当运行同一个命令在同一个项目下的解析时间差异?

如您所见,文件、行等也存在一些差异。有什么方法可以加快 WSL2 解析时间吗?

tsc -project ./tsconfig.json --diagnostics

Windows 10 shell (tsc 版本 3.1.2)

Files:          139
Lines:        35528
Nodes:       150245
Identifiers:  49306
Symbols:      38212
Types:         2460
I/O read:     0.05s
I/O write:    0.01s
Parse time:   0.74s
Bind time:    0.13s
Check time:   0.48s
Emit time:    0.13s
Total time:   1.48s

WSL2 Ubuntu同系统下18个LTS(tsc版本4.1.4)

Files:             175
Lines:           39622
Nodes:          161997
Identifiers:     56416
Symbols:         40823
Types:            2795
Instantiations:  12267
Memory used:    76663K
I/O read:        1.13s
I/O write:       0.16s
Parse time:     14.45s
Bind time:       0.36s
Check time:      0.39s
Emit time:       0.32s
Total time:     15.52s

这很可能是由于 windows 驱动器(/mnt 下的所有内容)在 WSL2 中的文件性能非常差。请在此处查看 WSL2 的错误报告:https://github.com/microsoft/WSL/issues/4197

可能有一些解决方法,如果您需要在您的机器上从 Linux 构建,对我来说主要的方法是使用 WSL1。