Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Not sure exactly what the situation was here, but if it was an NTFS folder from Windows shared into the VM/WSL, then you are indeed running the npm operation in the inner system but paying the cost of writing thousands of tiny files across that translation layer.


sort by: page size:

Hmm. I thought the problem was that NTFS is not particularly fast at file creation. Generally not a problem, except for the folks who wrote the npm tooling which generates 10,000 files in the blink of an eye.

Time the difference between an npm install, with all its thousands of tiny files, on NTFS and ext4. It's excruciating.

Yep, I feel (a little) bad for anyone doing node development on Windows (though I probably should feel bad that they're having to dev in JS).

But this isn't an "NTFS problem" as you'll have this occur on any filesystem that supports file system filters, like antivirus.


NTFS may not handle a bunch of small files well, but I'm pretty sure WSL isn't a virtuialization layer.

The issue is deeper than NTFS. Working on either side of the divide in WSL is plenty fast. Trying to move data across the divide is not.

Most of the performance issues are not NTFS so much as the prevalence of file-system filter drivers. This is why WSL had so many file-system performance issues despite the fact that it was using a custom FS. IIRC this also motivated the move to WSL2 from what I read, since a virtual machine can use a small set of files to store a whole FS.

EDIT: See here - https://github.com/Microsoft/WSL/issues/873#issuecomment-425...


It’s super slow.

If you deal with many small files on Windows, you will observe much better performances in WSL2/ext4 than windows with NTFS. Even though the ext4 filesystem is stored as a file inside a NTFS partition.

If you use NodeJS for example, it’s a very obvious speed difference.


Most compilation processes create a lot of very small files. Or a metric ton of them if you're unlucky enough to do js.

NTFS is awful at doing lots of small accesses on very small files, at least compared to Ext4. Add to that the fact that if you're on WSL, it needs to write POSIX attributes (which NTFS has no support for and therefore WSL must emulate), and that's a recipe for builds being slowed massively by IO.

As for Defender, well, Defender sees new files and halts everything while it scans them. You can see how that can be a problem for a process that pops out tens of thousands of temporary files, which it will all go and scan, locking them while it does so.


>It has different issues.

To clarify the "it" here, NTFS allows you to create a file named `aux.js` just fine. The thing that injects special handling of `aux.js` is the Windows object layer that sits on top of it.

    CreateFileW(LR"#(\\?\C:\Users\Arnavion\Desktop\aux.js)#", GENERIC_WRITE, 0, nullptr, CREATE_NEW, 0, nullptr)
will create a file named `aux.js` just fine, since it tells the Windows layer to not normalize names, which includes disabling the special handling of files named `aux`.

If your issues were disk speed related, you should know that accessing files in NTFS using WSL2 is very slow. You'll have to move your files to the Linux FS first.

I/O is the biggest issue on NTFS (which is why we use WSL for most of our node work - lots of small files to futz with); how about native (kernel) support for ext4 or zfs? That would be sweet.

Interesting. Did you tested any performance by non-NTFS?

I remembered this post. https://github.com/microsoft/WSL/issues/873#issuecomment-425...


This one? I remember it as an earnest description of the difficulties the WSL team had with the speed of NTFS - and I think it was one of the reasons for the switch to virtualisation in WSL2.

<https://github.com/Microsoft/WSL/issues/873#issuecomment-425...>


> As a rule of thumb, WSL 2 accessing host (NTFS) files is about 5 times slower than WSL 1 accessing those same files.

https://vxlabs.com/2019/12/06/wsl2-io-measurements/


So if accessing ntfs from wsl is now slow, you can put the files in wsl instead. The problem then, if you're using this as a dev machine, is how do you edit them in Windows? I want to use my JetBrains IDEs to edit wsl files, if that doesn't work I'd just stick with dual boot.

Well, there is a little bit of emulation. We have to encode and handle Linux-style file permissions, which has some overhead.

We are working on making both the WSL layer and NTFS itself better. For example, in the upcoming Windows release, we have created a fast path for stat that should yield a modest speed improvement.

We have a lot more work to do, though.


I think this is because WSL uses NTFS Alternate data streams to store linux file attributes, and they don't survive when a file is copied to a non-NTFS file system.

My issue is across the whole windows platform not just WSL. If you check large repos out on windows native it sucks too. Rather than just fixing WSL and declaring victory they should fix the NTFS problem.

NTFS also has a 260 character path limit [0], which as the sibling comment says can really jam up node_modules and the current HEAD of the intellij-community repo which currently has some giant filename in a subdirectory of its repo

I'm aware of their claim about using Group Policy to remove the limit but I've never used GP in order to know its sharp edges for my gaming computer

0: https://docs.microsoft.com/en-us/windows/win32/fileio/naming...

next

Legal | privacy