gpt4 book ai didi

javascript - yarn 在 Windows 上慢 5 倍

转载 作者:IT王子 更新时间:2023-10-29 03:15:00 25 4
gpt4 key购买 nike

当我向已运行 yarn install 的现有安装添加新包时,添加新依赖项需要 5 分钟,这与我刚刚执行 一样慢yarn install 还没有 node_modules

这正常吗?

我在 Windows 10 x64 上使用 Yarn 0.17.9。我确实让 Windows Defender 忽略了我的项目目录和 yarn 全局缓存目录。

编辑:这是我做的一些基准测试结果。基于它们,似乎 yarn add 实际上快了 30-40%,而真正的问题只是 yarn 在 Windows 上慢了 500%

编辑 2:我已确认尚未为项目和 yarn 缓存目录启用索引。但是现在我已经将 yarn 从 0.16.1 升级到 0.17.9,并且在 Windows 中速度提高了 35-50%!但它仍然比 Linux 慢 350-400%。我已经更新了基准。

Windows 性能问题似乎存在 Github 问题:https://github.com/yarnpkg/yarn/issues/990

基准:

--

Windows - yarn 安装(缓存):

Done in 172.29s.

Ubuntu - yarn 安装(缓存):

yarn install  48,75s user 11,32s system 117% cpu 51,161 total

--

Windows - yarn 添加 lodash:

Done in 143.11s.

Ubuntu - yarn 添加 lodash:

yarn add lodash  33,42s user 5,72s system 108% cpu 36,203 total

--

仅供引用,Ubuntu 基准测试是在 NTFS 驱动器上的同一文件夹上运行的。

用于基准测试的项目:https://github.com/amcsi/szeremi

最佳答案

在您的工作文件夹和 yarn 缓存文件夹上禁用 Windows 搜索索引以及完全或在一个文件夹上禁用 Windows Defender 应该会给您带来显着的性能提升。我在具有 SSD 驱动器的类似系统上减少了 30-50%,最初的时间与您的时间相同。

在 Yarn 缓存文件夹上禁用它也会给你一些加速。它的位置由 yarn cache dir 命令显示,默认为 %USERPROFILE%\Local Settings\Yarn\cache

要禁用文件夹的搜索索引,在资源管理器中找到它,右键单击,然后属性 - 常规 - 高级,取消选中“允许此文件夹中的文件除文件属性外还索引内容”复选框,然后应用更改.

这个性能问题已经存在于 yarn github(2016 年 10 月)上并且目前仍然开放:https://github.com/yarnpkg/yarn/issues/990

关于javascript - yarn 在 Windows 上慢 5 倍,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40566222/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com