<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Steve Lambe on Medium]]></title>
        <description><![CDATA[Stories by Steve Lambe on Medium]]></description>
        <link>https://medium.com/@firrae?source=rss-c2cbfa99664c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*muA2r97mTX1kDCUN.jpg</url>
            <title>Stories by Steve Lambe on Medium</title>
            <link>https://medium.com/@firrae?source=rss-c2cbfa99664c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 09:40:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@firrae/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[WSL2, Ruby on Rails and Development Performance]]></title>
            <link>https://firrae.medium.com/wsl2-ruby-on-rails-and-development-performance-6a36e40bd38b?source=rss-c2cbfa99664c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a36e40bd38b</guid>
            <category><![CDATA[wsl-2]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[windows-10]]></category>
            <dc:creator><![CDATA[Steve Lambe]]></dc:creator>
            <pubDate>Fri, 01 Jan 2021 00:51:37 GMT</pubDate>
            <atom:updated>2021-01-01T01:08:57.606Z</atom:updated>
            <content:encoded><![CDATA[<p>{TLDR at bottom}</p><p>Recently I decided to try out WSL2 as my development bridge to Linux. Coming from using mainly Mac and Linux for development I was used to development tools just working and was keen to see just how seamless Microsoft had gotten WSL2 to have so many developers promoting it so loudly. What I’ve found is, once you figure out the weird initial issues, you have a fairly decent developer experience. Now while the title specifies Ruby on Rails (Rails from now on), this info should apply to most, if not all, languages, frameworks and tools. Rails was just the first I tried, and the one I saw the biggest issues with the fastest.</p><p>WSL2 is marketed as having all the benefits of Linux while still being inside Windows and having it’s UI/UX (for better or worse), abilities and support. While I have found that true, it’s been a few late nights wading through unexpected slowness, specifically with Rails.</p><p>The beginning of the issues is the way Windows Terminal, the recommended interface for WSL2 by pretty well everyone, drops users into what seems like an obvious location to begin working. It drops you into your Windows “home” directory. While this seems like the obvious place to put your projects, this is where the core issue lies. Windows mounts its filesystem into the guest OS and their implementation seems to be extremely slow. This lead to me starting a bare Rails 6 app with Webpacker and seeing build times of 10 seconds with next to nothing in it! The worst part, this isn’t the only issue.</p><p>You’ll find a number of things broken or buggy with this mount point like:</p><ul><li>File changes don’t trigger events</li><li>File line endings can end up being inconsistent depending on what is modifying the files</li><li>I had VS Code and RubyMine have delayed file structure updates when I made directory changes or created files from the Linux CLI (likely part of point 1)</li></ul><p>The slowness though only got worse. I naively thought “you know, that’s not terrible, maybe it gets better over time?” Then I added Tailwind CSS (2.0) which I knew had some <a href="https://github.com/tailwindlabs/tailwindcss/issues/2820">slowness issues</a> already. In doing so I found Webpack (Webpacker is just a Rails wrapper over Webpack) rebuilt EVERYTHING every time a single character changed in the source. If you are used to Linux or Mac speeds, you might be like “ok, that shouldn’t be terrible due to caching”. Remember I started at 10+seconds already, adding Tailwind brought each build to at minimum 35 seconds with random peaks of 55 seconds at times, for whatever reason. After reading more and more about speed issues with Tailwind and getting nowhere I decided to test Bootstrap 5: still 30+ seconds every time I change a file in any way.</p><p>So the issue wasn’t Tailwind, at least not fully, so I decided to look more into the performance of WSL2 and found this magical comment in a WSL2 GitHub issue: <a href="https://github.com/microsoft/WSL/issues/4739#issuecomment-582374769">https://github.com/microsoft/WSL/issues/4739#issuecomment-582374769</a>.</p><blockquote>Accessing Windows filesystem from WSL2, when developing is extremely slow. While moving projects to WSL2 filesystem, will increase performance, much faster than WSL1 &amp; Windows development. (WSL2 can be accessed in path \\wsl$\)</blockquote><p>That’s the key here. While all aspects of these issues are not great, this line contains the magic answer and it’s pretty darn simple: move your project into the WSL2 filesystem. Open a file explorer and point it at \\wsl$\&lt;Linux distro name&gt;\home\&lt;Linux user name&gt;, open a second file explorer to the directory holding your target projects, copy and paste them to the WSL filesystem location of your choice, other than the Windows mount of course.</p><p>Now, while that might just work for some projects, languages and frameworks, I found for Rails I had to do one extra step in telling it to reinstall Webpacker using rails webpacker:install. I reinstalled my JS modules as well for good measure just in case as well, but the Wepacker reinstall was required otherwise permissions seemed to be in a weird state and Webpack couldn’t run.</p><p>After doing this I’ve gone from:</p><ul><li>No working file watcher</li><li>Full application rebuilds for every change</li><li>Build times from 35 to 55 seconds</li></ul><p>To:</p><ul><li>File watcher just works</li><li>Caching works now and only rebuilds what is necessary</li><li>Build times so far max at 2.8 seconds for initial builds, incremental builds as low as 25ms (real world it’s been about 150 to 300ms for my real files and not dummy test files)</li></ul><h3>So TLDR</h3><p>If you are building your projects in the default location Windows Terminal presents you when you open a terminal into your guest OS:</p><ul><li>Move it as that’s not actually inside your guest OS and is super slow. Move it to somewhere adjacent to ~/ (your guest OS home directory) and run it from there.</li><li>Point our IDEs at \\wsl$\&lt;path to project&gt; and edit code that way from any IDE.</li><li>Save tons of time and live, at least most of, the promised development experience with minor inconveniences until Microsoft can fix their filesystem bridge and make it performant.</li><li>I am now at least happy with developing in Windows, though time will tell if I revert back to just using Linux primarily.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a36e40bd38b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>