Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
213 views
in Technique[技术] by (71.8m points)

javascript - Yarn 5x slower on windows

When I add a new package to an existing installation where yarn install has already been run, it takes 5 minutes to add a new dependency, which is as slow as if I just did yarn install without node_modules there yet.

Is this normal?

I'm using Yarn 0.17.9 on Windows 10 x64. I did make Windows Defender ignore my project directory and yarn global cache directories.

EDIT: here are some benchmark results I did. Based on them, it seems that yarn add is actually 30-40% faster, and the real issue is rather just that yarn is 500% slower on Windows

EDIT 2: I have confirmed that indexing hasn't been enabled for the project and yarn cache directories. But now I have upgraded yarn from 0.16.1 to 0.17.9 and there was a 35-50% increase in speed in Windows! But it's still 350-400% slower than in Linux. I have updated the benchmarks.

There seems to be Github issue for the Windows performance issues: https://github.com/yarnpkg/yarn/issues/990

The benchmark:

--

Windows - yarn install (cached):

Done in 172.29s.

Ubuntu - yarn install (cache):

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

--

Windows - yarn add lodash:

Done in 143.11s.

Ubuntu - yarn add lodash:

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

--

FYI the Ubuntu benchmarks were run on the same folder on the NTFS drive.

Project that was used for the benchmarks: https://github.com/amcsi/szeremi

question from:https://stackoverflow.com/questions/40566222/yarn-5x-slower-on-windows

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Disabling windows search indexing on your work folder and yarn cache folder as well as disabling windows defender completely or on a folder should give you significant performance boost. I've got 30-50% decrease on similar system with SSD drive, originally timings were as yours.

Disabling it on Yarn cache folder would also give you some speedup. Its location is shown by yarn cache dir command, %USERPROFILE%Local SettingsYarncache by default.

To disable search indexing on a folder, find it in Explorer, right click, then Properties - General - Advanced, uncheck the "Allow files in this folder to have contents indexed in addition to file properties" checkbox, then Apply the changes.

This performance issue already exists on yarn github (Oct'2016) and is still open to the moment: https://github.com/yarnpkg/yarn/issues/990


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...