Microsoft is preparing the release of Windows May 2020 Update (20H1). This update will contain some nice UI improvements, but what's more important to developers and other insiders is that the new version of Windows will have
Dave Rupert installed WSL 2 on his 13" Surface laptop and first results
pleasantly surprised:
The second version of WSL is 13 times faster than the first! It's not every day that you get a 13x performance boost for free. I felt chills and shed a stingy male tear when I first saw these results. Why? Well, basically I mourned the wasted time that had accumulated over the 5 years of working with the first version of WSL.
And it's not just numbers. With WSL 2, installing npm, building, packaging, viewing files, reloading hot modules, starting servers—just about everything I use on a daily basis as a web developer—became significantly faster. It feels like I'm back at my Mac again (or perhaps better, since Apple has been drastically limiting its processors in favor of battery life over the past few years).
Where does such a rush come from?
How did they achieve a 13x increase in productivity? Earlier, when I thought about switching to a Mac, I also threw in some options, however, purely at the level of assumptions. The fact is that writing to disk and Linux system calls were quite expensive (in terms of time costs) due to the architecture of the first version of WSL. And now guess what modern web development relies heavily on? Yes. When you're putting together a bunch of dependencies and code snippets every time you save a file, you're actually doing a lot of disk writes and system calls on tens of thousands of files.
Once you learn this the hard way, it's hard to forget everything afterwards. You begin to gradually become depressed when you imagine how slowly and sadly all this works. And you understand that your world will no longer be the same and the tool that you liked no longer seems useful and effective.
Fortunately, the WSL team took the risk and completely rewrote the subsystem. In WSL 2, these problems were solved: the developers built their own Linux virtual machine into Windows and delegated file operations to the VHD (Virtual Hardware Disk) network drive. The trade-off is that on the first run, you have to take the time to spin up the virtual machine. This time is calculated in milliseconds and is hardly noticeable to me personally. I, for one, am waiting with pleasure, because I know what all this is for.
Where will the files live now?
To take full advantage of WSL 2, you'll want to move your project files from /mnt/c/Users/<username>/ to the new home directory ~ / Linux on the new VHD. You can see the contents of this drive online by going to \\wsl$\<distribution name>\<username>\home or by entering the command explorer.exe from your bash shell.
This is a real Linux file system and it acts and behaves as you would expect. I created a folder ~/projectswhere all my project repositories live and then I open the projects in Visual Studio Code using the code command.
What about VS Code?
Installing WSL-
I was a bit frustrated at first about having to install this extension because I needed to reinstall what I had installed and configured before. But now I appreciate it, because there is a special visualization layer that shows what environment I work in and where my files live. This made web development on Windows more transparent and made it much easier to use the UI for version control in VS Code.
Tears of happiness and hope for a brighter future
I can't help feeling excited about the next release of the Windows May 2020 Update and the optimized Linux subsystem that just flies on my powerful gaming PC. Perhaps there are some other problems that I don't know about yet, but after
Moreover, do not forget that
Having worked on Windows for 5 years, I've been through a lot: not being able to install Rails, struggling with Cygwin's artificial shells. I sat in the front row at the same Build 2016 conference when Microsoft announced the first version of WSL. And then I had hope that web development on Windows would finally reach a new level. Without a doubt, WSL 2 is the biggest improvement I've seen since then, and it looks like we're on the cusp of a new era.
As advertising
If you need to work Windows servers, then you definitely
Source: habr.com