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
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 Settings\Yarn\cache
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