WSL2: Great performance on Windows

Sat 5 Feb 2022

(W)indows (S)ubsystem for (L)inux 2 has brought a lot to the table for developer. It allows for all the essential tools we know and love to be available on Windows.

I've been working with Docker on Linux since release. As side tracks I made sure it worked on Windows and OSX yet never had to use it on there.

Now, I'm working on a Windows machine, which is not by choice but fine. My best mate discovered that you can get a lot of performance by keeping the files in your \\wsl$. I'm sure there might be people headbutting now as that might seem like an obvious thing. It really was not to me.

You see, on Windows there is a distinction between Windows and Linux containers. They offer differrent services of which one of them is the underlaying filesystem with it's features. Keeping the files for a Linux container inside the \\wsl$ mount will give you a near native speed. Same thing goes for Windows containers, keep those files on Windows.

I looked back on documentation and it has a few lines regarding this. I do think they could explicitly tell this when talking about Linux or Windows containers.

* Store your project files on the same operating system as the tools you plan to use.

For the fastest performance speed, store your files in the WSL file system if you are 
working on them with Linux tools in a Linux command line (Ubuntu, OpenSUSE, etc). If 
you're working in a Windows command line (PowerShell, Command Prompt) with Windows 
tools, store your files in the Windows file system. Files can be accessed across the 
operating systems, but it may significantly slow down performance.

That said, it was right there in the documentation. I've only been using Windows and Docker for a couple weeks now and pretty stoked to see the performance be near native speeds.

That is pretty much what I wanted to share today. It is always nice to look at things with an extra set of eyes to spot these things.

Happy coding!