DEV Community

Cover image for Why is WSL2 so slow?

Why is WSL2 so slow?

kleeut profile image Klee Thomas ・2 min read

I've been playing around at using WSL2. This is my first time using Window Subsystem for Linux having skipped over WSL1.

I typically like to write my software in Node JS, TypeScript and React and I assumed I would be fine jumping into the projects I had previously been working on in my previous Windows and Power Shell environment. The thing I noticed was that my React projects seemed to be running slowly. I mean really slowly. Unusable slowly. I thought that there was something wrong with my Node and WSL set up and I started looking for Node issues on WSL2.

It turns out that WSL2 can be really fast but... only if you use the Linux file system. When opening files stored on Windows (where all mine are/were) it painfully slow.

How slow? I put on some music and timed it. Running npm start on my Lenovo Yoga laptop with an i7 processor and 16gb of RAM on a Create React App project freshly set up, It took 4:50, 4 minutes and 50 seconds to render the page when running from the Windows file system. Much too slow for me to think about moving away from PowerShell.

So how fast can it be? Same laptop, same test, but running from the a directory on the Linux file system; 4.9 seconds from hitting enter on npm start to the standard new project page rendering.


If you want a fast experience using WSL2 move your projects to the Linux file system.
This means that using WSL2 is much more of an all or nothing break than I would have liked, but I'm still thinking I'll commit to the change, at least for new projects.

Discussion (11)

amorpheuz profile image
Yash Dave

WSL1 is the choice to go for if you want to have good performance across OS file systems! Check out the Comparing WSL 2 and WSL 1 on Microsoft Docs for which WSL version suits your use-case the best, since for now, Microsoft has indicated that both projects will be kept alive separately.

kleeut profile image
Klee Thomas Author

Thanks, I think for now I'll stick with wsl2 and run from the Linux system. I was just shocked when I was caught out by the initial slow performance.

kidkkr profile image
kidkkr • Edited

You can use WSL2 file system itself. (its on \\wls$\.... )
/mnt/c/.. is really slow as you said.
if you use Debian, \\wls$\debian will be / in your WSL2 distribution.

doctoru profile image
Steve H

This is the best suggestion I've found to the problem of slow compile so far.
I am now re-partitioning a spare disk to store my projects on a native Linux partition - I'll let you know!
I'm Playing with Jekyll, which needs native compilation of several gems in 2021...

aminya profile image
Amin Yahyaabadi • Edited

That was interesting. I was having the same issue on WSL2, and I was surprised because WSL2 was advertised as faster. Moving the files over to \\wsl$\Ubuntu\home\<user name>\ fixes the issue

alg2 profile image

Yes, I just realized the same thing, that WSL2 is a dog. And I just finished moving over from WSL1 to WSL2 on my main development box and my laptop.

kleeut profile image
Klee Thomas Author

A year on I haven't looked back. WSL2 is my main terminal and I'm using it productively, I haven't found a need to go to the Windows file system so it's super fast.

kristenkinnearohlmann profile image
Kristen Kinnear-Ohlmann

Thanks for this advice. I will need to create a React project for my bootcamp and this could make a difference for me. I'll look into how to do this right away!

elephantcastle profile image

Another advantage is hot-reloading actually working for react and vue; I had always had to use workarounds in win10 with WSL2

alancphilpott profile image
Alan Philpott

Having my files on the Linux FS makes absolutely no difference to the compile time. Also under Windows and adding the folder the Windows Deference exclusions makes no difference. It's sad.

zmrfzn_2 profile image
zameer fouzan

i think it is really because internally its like a network mounted drive. thus the additional delay.
however, now that it has options to browse files on explorer, i think sticking to linux FS is okay

Forem Open with the Forem app