-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need a big optimization for Windows #990
Comments
+1 |
Hi @OshotOkill! Thanks for trying Yarn. Are you using Cygwin or WSL ("Bash on Ubuntu on Windows")? Both are known to have pretty bad disk IO performance. Also, React Native has a huge number of files so copying them into
The main improvement with Yarn is when you have a warm cache (ie. after you've installed a package at least once), but with React Native, the huge number of files will also be a cause of some of the slowness. |
@Daniel15 Nope, I'm not using Cygwin/MinGW/MSYS2 or WSL (the latter fails due to a knotty bug). According to your description I can assume the problem is caused by the file system (NTFS) right ? Even if a warm cache exists, the copying process still runs much slower than MacOS. Hope the dev teams can come up with a solution ASAP. Thanks. |
I'm seeing the same. Do install, wipe node_modules, install MacBookPro takes 17 seconds, my Windows machine takes 122 seconds. |
Somebody pointed out this might be related to anti-virus software scanning node_modules and the global yarn cache continuously. Can you try disabling it for those folders? |
@cpojer I guess they are right . I don't have any anti-virus software on my machine except the pre-installed Windows Defender, so I banned the scanning of global cache folder & my project folder and did some test: Default: 128.08s No scanning of cache folder: 104.43s No scanning of project folder: 78.28s No scanning of cache folder & project folder: 53.48s Though it's slower than Mac for 10+s, it has a significant boost. This should be informed from the official docs I think. |
Good catch! I totally forgot about this as I already have @OshotOkill - Would you like to submit a pull request adding a note about antivirus apps to the website, in the Windows installation instructions? Here's the file you'd need to edit: https://github.com/yarnpkg/website/blob/master/en/docs/_installations/windows.md (you can edit it directly on Github). It'd be appreciated 😄 |
I wasn't as meticulous as @OshotOkill, but I added exceptions for my source and my node install folder, and then specifically exempted the yarn, npm and node binaries and now my fresh install time on Windows is down to 50 seconds from 122 seconds. |
PR has been merged. Close this issue. |
This is still painfully slow on windows, even deactivating anti-virus and Windows defender. I don't think it's just an environment issue (like this anti-virus solution) but it looks like yarn tries to copy all the files, 1-by-1 even if you install some unrelated dependency. Why not just delete/copy the files that need to change? If I had |
I have created a StackOverflow article about this too: http://stackoverflow.com/questions/40566222/yarn-5x-slower-on-windows By the way in my (dual-booted) Ubuntu benchmarks I was using the same NTFS drive as the one Windows normally runs on; and it's still fast there. |
Adding |
I'll definitely try this out! |
It did seem to improve the speed a bit 212 -> 170 seconds |
Another issue I have noticed - Indexing service on Windows tries to index every file in node_modules. |
My windows isn't set to index the path in question, so that still doesn't solve the issue. |
So to sum up there are 4 ways to improve performance:
|
@Altiano yes, but it's still not enough to get performance even close to Mac/Linux |
Seems kinda sketchy that you'd have to disable AV or indexing on directories to make yarn as fast or faster than npm. After all, you don't have to do this for npm. I decided to give yarn a shot because it stated it was fast and the offline installs made coding without a network connection a plausible thing. Is there no way to optimize the linking? |
According to some issues that relate here and the comments above, I'd like to reopen this issue in order to gather some other solutions. Personally I suggest to list the hardware configurations about your test machine and upload some related pics. There could be many other irrelevant elements that make a big difference between platforms rather than Yarn itself, i.e. the benchmark performance of the SSD on a MacBook is usually much better than a Windows machine. |
I think you have badly hoisted node_modules, this bug is going to be fixed in #2676 |
With @bestander's introduction of hardlinking in #2620 (Which works fine in Windows 7 without administrator privileges), my overall installation times, and Without hardlinking:
With hardlinking:
|
Wait for 0.21.1, it will have @kittens' fix to hoisting.
Should be even faster
…On Wed, 15 Feb 2017 at 20:04, Hutson Betts ***@***.***> wrote:
With @bestander <https://github.com/bestander>'s introduction of
hardlinking in #2620 <#2620> (Which
works fine in Windows 7 without administrator privileges), my overall
installation times, and node_modules/ size, dropped.
Without hardlinking:
Done in 167.76s.
real 2m49.633s
user 0m0.229s
sys 0m1.368s
du -sh node_modules/
216M node_modules/
With hardlinking:
Done in 58.07s.
real 0m59.967s
user 0m0.183s
sys 0m1.369s
du -sh node_modules/
189M node_modules/
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#990 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACBdWAEghXfPo4bX9mN0hV8l8YaH2rmlks5rc1pigaJpZM4KVwpA>
.
|
I am on Win7 /w Yarn v0.21.3
Had to wait this amount of time adding any new package with Have some other AV running so just following these steps as above mentioned by @Altiano
Will update on this one |
@kuncevic, what would be a clean install time for the project? |
@bestander this is the same problem with me. Any Everytime this happens:
As I said, this happens every single time I run @bestander if you want a reproducible case, please clone this repo: https://github.com/kumarharsh/yarn-bug, and run |
Yarn is preserving determinism every time it runs add/remove, so it needs to check if any dependency got hoisted to the root of node_modules when dependencies change. Fetching dependencies - download, you can't optimise it. Yarn optimises file copy operations by checking if the files are the same before doing the copy. What about npm, how fast it does clean install? |
A clean install for npm ( A clean install for yarn (
|
@bestander @kumarharsh Yarn doesn't optimises file copy operations on windows due to a libuv/nodejs bug (See #2958 for a potential fix in yarn code) that isn't present on node 7.1+ so you can get your second command ( Using windows file copy operation is a little bit faster than using node API to copy files too (See #2960 for a potential PR) and would optimize |
Just updated to 7.8.0
However by doing p.s.
|
@kuncevic Nice to see that upgrading node works for Regarding empty for /f "delims=" %i in ('yarn cache dir') do set yarncachedir=%i
xcopy /E /Y /I /Q node_modules %yarncachedir%\x-temp And then for each test I cleaned rd node_modules /s /q
powershell -Command "Measure-Command { xcopy /E /Y /I /Q %yarncachedir%\x-temp node_modules}" And took the total seconds. ResultsHere are the results on 3 PCs
Each time AV was enabled it was toping the CPU chart during In conclusion
|
Adding npm, yarn cache folders and node.exe to defender's exclusion list would be enough, of course all this can't be in indexed folders. Now yarn add / rm takes 7 secs |
Thanks everyone, a significant optimization for Windows landed in 0.24 #3234 (comment) |
@vbfox Can you please add version numbers for |
this is still a piece of shit for MacOSX |
I'm still experiencing some crazy install times. Linux versions: $ yarn -v
1.3.2
$ node -v
v8.9.3 Windows versions: > conemu-cyg-64.exe --version
ConEmu cygwin/msys connector version 1.2.2
> wslbridge.exe --version
wslbridge 0.2.3
> Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | Select-Object ProductName, CurrentMajorVersionNumber, CurrentMinorVersionNumber, ReleaseId, CurrentBuild, CurrentBuildNumber, BuildLabEx
ProductName : Windows 10 Pro Insider Preview
CurrentMajorVersionNumber : 10
CurrentMinorVersionNumber : 0
ReleaseId : 1709
CurrentBuild : 17025
CurrentBuildNumber : 17025
BuildLabEx : 17025.1000.amd64fre.rs_prerelease.171020-1626 I've got two (and a half) questions:
|
Thanks for raising a new issue, I'll respond there |
It's been almost an hour now and I'm waiting for this command to finish the process. I've followed the above points mentioned by @Altiano but nothing works |
do we have any alternative for this? like can i use |
So finally after struggling for 2-3 hours, I had to use |
Not sure how this is helping, but it is. Initially one change triggered a compilation that took ~1 minute. After running the steps below, it took 3-10 seconds. Not sure if it's still related to Windows Defender, or how fast the file access is improved after the complete delete and re-install (maybe it's like a defragmentation that helps on reading speeds?) Install RimRaf:
Build and Serve are now working normally 👍 |
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
I've tested a lot about the installation speed between MacOS and Windows. According to the results it seems that yarn has far less optimizations for Windows. e.g. Here are the comparisons of installing
react-native
:MacOS
npm@3.10.9: 1m 31s
yarn@0.15.1: 39s
Windows
npm@3.10.9: 2m 24s
yarn@0.15.1: 2m 19s
So, it seems yarn has no advantage over npm on Windows. Did anyone face with this appearance?
Please mention your node.js, yarn and operating system version.
nodejs: 6.8.0
yarn: 0.15.1
OS: Windows 10 14393.321 & MacOS 10.12
The text was updated successfully, but these errors were encountered: