The Great Computer Experiment: Ruby Edition
Can a second-hand desktop computer from 2013 run specs? How much does a touch bar speed up an integration suite? Do I need 6 cores to run
rails new blog?
In this article I’ll put 4 machines and 5 different operating systems through a true test. What am I trying to achieve? I don’t know. But I intend to share my experience with you.
Recently, I’ve been playing with different computers and operating systems. I used to be a C# developer on Windows for quite a few years and after switching to Ruby I started using Macs. The direction Apple took with its latest laptops made me explore other options and I tried Linux on a desktop PC. And I was surprised how powerful and cheap desktops are these days.
Here are the machines that feature in the showdown. Prices are for New Zealand.
Custom-built PC (2019)
- i7-8700 (3.2-4.6Ghz, 6 cores with 12 threads)
- 32GB RAM
- Samsung 970 EVO Plus NVMe SSD
- Ubuntu 18.04
Price: $1 500 ($950 USD) new
This is my main office workstation. It’s custom-built with decent components but nothing lavishly outrageous. It’s a perfect compromise of snappy performance and cost. It runs basic Ubuntu 18.04 installation with no customisations. Good reliable work horse.
Macbook Pro 13” (2013)
- i7-4558U (2.8-3.2GHz, 2 cores with 4 threads)
- 8GB RAM
- macOS 10.14 Mojave
Price: ~$700 ($450 USD) second-hand
The price is for a similar machine on the second-hand market in New Zealand. This has been my day-to-day machine for the last 6 years. I still use it when working from home or on the go.
Double amount of RAM would be better and maybe more cores but I’m not planning replacing it any time soon. It is a solid laptop with a great keyboard and beautiful screen. Recently, I was tempted by some of the new ThinkPads but I’m too scared of Linux on a laptop. If there is something I don’t want to do it’s tinkering with touchpad drivers, keyboard backlighting, and wonky wi-fi.
Budget Dell (2013)
- i5-4570 (3.2-3.6GHz, 4 cores with 4 threads)
- Crucial MX500 SATA 3 SSD
- 16GB RAM
- Windows 10 WSL 2 Ubuntu 18.04
- Ubuntu 18.04
Price: $250 + $70 RAM + $95 SSD ($260 USD) second-hand with new SSD and RAM
This PC is Dell OptiPlex 9020 that was released mid 2013 – close to my Macbook Pro. Machines like this are great if you are short on budget. They are build to last and cheap. I was lucky and got mine for free from an office giveaway and immediately replaced HDD for SSD. It came with Windows and I started using it for photo editing with Adobe Lightroom and Photoshop at home. Since then I added extra RAM and GPU to make Lightroom snappier (GPU is not included in the price though).
I will use it as a guinea pig for WSL 2 and bare metal Linux to compare the two. Is it worthy alternative for my trustworthy Macbook? Is WSL ready for serious work? Can we finally develop Rails on Windows?
Macbook Pro 13” (2018)
- i7-8559U (2.7-4.5Ghz, 4 cores with 4 threads)
- 16GB RAM
- macOS 10.14 Mojave
Price: ~$4 800 ($3 000 USD) new
Last year’s top of the line Macbook comes with a hefty price tag. I’m not a big fan of the keyboard and touch bar and this nugget belongs to my friend who helped me out with running some of the benchmarks.
It will be interesting to compare it to the custom-built PC.
For each test I ran it 4 times, then discarded the worst value, and averaged the rest. While running the tests I was doing some light web browsing (if there is such a thing) and ran Slack to simulate happy developers’ day.
These are not your typical synthetic benchmarks but a real world performance. Including hackernews and epilepsy-inducing giphies.
This is the most important test. The codebase that I work on day to day is the benchmark. It is a standard Rails monolith with React front-end and the suite is a combination of
- rspec (single-threaded),
- feature specs (headless chrome) and
Linux is the clear winner here. The 2018 Macbook Pro is ~10% slower than the PC. And WSL 2 is 1.4x slower than running native Linux. What a bummer.
What surprised me is how good the old Dell with native Linux is. It ran the suite in almost the same time as the custom-built PC from 2019. I don’t have a good explanation for it – I was expecting it to be worse. The CPU is slower (3.6GHz vs 4.6GHz) and the disk is slower (budget SATA 3 SSD vs NVMe).
Next task is CPU intensive Ruby 2.6.5 compilation.
The 2013 Macbook Pro is showing its age here. The combination of 3.2Ghz with macOS are not cutting it. Again the bare metal Linux dominates and surprisingly the new 2018 Macbook Pro is lagging behind.
The popular gem for rails authentication has a small set of unit and integration tests. No parallelisation here either.
Linux PC is up by a mile but the WSL 2 on a budget hardware is beating 2018 Macbook Pro.
This suite is a good mix of unit, integration, and UI specs. Also, it makes use of some parallelisation so the results might be interesting.
First win for macOS on the 2018 Macbook Pro – just by a second ahead of the Linux PC. Solid performance with budget Dell and WSL 2 is acceptable.
Last one is running the social network test suite with a mix of unit, integration, and UI tests. It is a good representation of standard Rails project.
Unfortunately, it’s missing numbers from the 2018 Macbook Pro but let’s compare the remaining.
The Linux PC is claiming the title back here and budget PC is lagging behind by more than 40s. There is a performance hit on the WSL 2. With 2013 Macbook Pro you are better off running the suite in your CI pipeline.
Firstly, all these machines are perfectly capable of developing Ruby and Rails applications. While coding you might be running a spec or two and leave the whole suite to your CI. That makes even a 6 years old laptop acceptable while on the road.
What surprised me is how good the old Dell with bare metal Linux performed. You can get this machine for so little money and have an excellent PC for work.
Linux in general is not such a hassle as it used to be. As long as you keep things simple and stick to the vanilla settings. I’m not too demanding and I avoid common pitfalls (high DPI displays, power management, customising UI, etc.) so it works for me. Not having an official OneDrive client and Office sucks though.
WSL 2, while still in preview, is a decent option and I didn’t run into any issues with it. In combination with the new Windows Terminal and Visual Studio Code it is a joy to work with. It might be the end of Macbook domination in the laptop space for web developers. Still you are getting a performance hit but Windows ecosystem might be worth the trade (or not … depending on your personal preferences).
Would you like to get top 5 links on Programming every Monday?
Sign up to Programming Digest and stay up to date!
Did you like the article? Send me a comment!