WSL performance issues while working on the codebase

Hi all. I’ve run into some serious performance issues with WSL2 on my laptop. It has an AMD Ryzen 7 4700U 8-core CPU and 16GB of RAM. It also runs up-to-date Windows 10 Pro.

I set up Ubuntu 22.04 LTS and the freeCodeCamp repo locally by following the contribution guidelines almost to the letter. While WSL always slowed down significantly when I was coding my PR, running pnpm run test completely freezes WSL 100% of the time.

So far, I’ve tried the following solutions, but none of them has helped in any meaningful way:

  • Closing all other applications, so that only Docker Desktop and Windows Terminal are running in the foreground.
  • Increasing the size of Windows paging file to 1.5x - 3x that of my physical RAM.
  • Dual-booting Ubuntu and Windows. Sadly, Ubuntu has poor support for my laptop’s hardware. The entire system froze every 15 minutes. There were multiple critical issues in the log viewer. I didn’t want to spend days troubleshooting them all, so I gave up.
  • Upgrading to Windows 11, hoping for better WSL integration. Ironically, Windows 11 couldn’t even find the wsl command and threw some cryptic error messages about the .NET framework.
  • Rolling back to Windows 10 and performing a clean reset. This time, I installed only the software necessary for freeCodeCamp development. I also upgraded WSL to 2.0.4 pre-release and enabled autoMemoryReclaim. Again, neither gradual or dropcache made any difference.

So it seems I’m stuck with Gitpod at the moment. But Gitpod has its own challenges, namely, port forwarding with Jest snapshots. I’m still struggling to figure it out and procrastinating by writing this post…

Have you had similar issues with WSL? How did you solve it? And if WSL is working smoothly for you, how much physical RAM do you have?

Thanks for reading. Any input is greatly appreciated!

Hello there,

I have been using WSL about as long as I have been contributing to the codebase, and it has been mostly smooth sailing.

I have had my share of issues with missing tools, low memory, network issues (Windows’ 127.0.0.1 vs Nodejs on Ubuntu’s localhost not resolving), and permission errors but many of these have been ironed out with the latest WSL versions.

I wrote a bit about my setup here: Introduction - Open Source Contributor

Two main getaways I have learnt (not necessarily WSL specific):

  1. 8GB is not enough for freeCodeCamp/freeCodeCamp (last I checked, WSL defaults to half of what you have, or 8GB - whichever is smaller)
  2. Many errors can be simply solved by installing a missing tool. Whether that be build-essentials or Microsoft Visual Studio 2019…

For your specific case, I would actually recommend:

  • Updating to Windows 11
    • It is not that different to Windows 10, but comes built in with useful WSL/development tools (e.g. Xvfb, ability to run GUIs in/through WSL)
  • Set your wsl memory to 12GB
  • NOT run pnpm run test
    • I hardly ever do this, and usually it is not what you need to do. Usually, you just want to test something specific to either the curriculum or the client or the api - almost never all 3.

Hope this helps

2 Likes

Update:

I solved the WSL “Class Not Registered” issue by manually downloading and installing 2.0.4 from the releases page. Should have thought of that sooner…

I’m now dual-booting Ubuntu Kylin and Windows. Turns out the made-for-China Ubuntu flavor has much better support for my cheap Chinese laptop. Who knew?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.