macOS vs Ubuntu Linux
by Željko Filipin
I do most of my work on a 27-inch iMac from 2012. It’s a good desktop machine.
When traveling, I use a 11-inch MacBook Air from 2014. It’s a very small and convenient laptop. It’s powerful enough, but barely. I have to be very careful with resources when I’m working on it.
For a while now I was thinking about dual booting the laptop with a Linux, to see how it would behave. I’ve finally dual booted it with Ubuntu this week. As soon as the machine was mostly functional under Ubuntu, I’ve decided to test it.
For reference, here’s the table with the two machines, with some relevant data. For readability, I’ve omitted the data that’s the same as in the above row.
|Machine||Processor||RAM (GB)||OS||Docker||Docker Compose||Fresh||Node.js||npm||MediaWiki|
|iMac 13,2 (27-inch, 2012)||3,2 GHz Quad-Core Intel Core i5||16||macOS 10.15.7||20.10.6||1.29.1||21.04.1||10.24.1||6.14.12||1.37.0-alpha|
|MacBook Air 6,1 (11-inch, 2014)||1,4 GHz Dual-Core Intel Core i5||4||macOS 11.3.1|
Two things that I do the most are installing npm dependencies (
npm ci) and running tests (
npm run selenium-test). For this blog post, I’ll use MediaWiki Core repository and it’s Selenium test suite. The suite is targeting a local MediaWiki. It’s running in a local Docker container via MediaWiki-Docker.
Both tests have two variants. One variant will run the command from the operating system (without a container). The other variant will run the commands from a Fresh container. Fresh is “a fast and ready-to-use Docker container with various developer tools pre-installed.”
Since a blog post without an image is no fun, I took a couple of screenshots.
Air + Ubuntu + Fresh +
npm run selenium-test
Air + macOS + Fresh +
npm run selenium-test
The screenshots show that on Ubuntu the machine was using 1.5 GB RAM, while on macOS it was using 3.2 GB RAM. The difference is in the Linux virtual machine that Docker runs in the background on macOS.
I’ve tried to keep the environments as simple as possible. When running the commands, only the Terminal application was open. I was primarily interested in how much RAM will be used when running the tests in the Fresh container, since the laptop has only 4 GB. I’ve also measured how fast each command runs.
I wasn’t interested in very good data. I just wanted good enough data for my use case. For that reason, I’ve only run each command three times. That’s just enough data to show any trends, but not so much that I’ll get bored while waiting for them to finish. All results are in how much time (in minutes) each command took in different environments.
iMac + macOS
iMac + macOS + Fresh
Air + macOS
Air + macOS + Fresh
Air + Ubuntu
Air + Ubuntu + Fresh
I was expecting to see less RAM used while running the commands on Ubuntu. No surprise there. How much time it takes to run the commands was a big surprise. It is so much faster on Ubuntu, it’s amazing.
npm ci takes about half a minute to run on powerful desktop machine running macOS, outside of the Fresh container. It takes more than three minutes to run the same command inside the container.
It takes about quarter of a minute to run the command outside the Fresh container on a non-powerful laptop running Ubuntu. Running inside the Fresh container takes about half a minute. That’s the same amount of time the desktop took to run the command outside the container!
npm run selenium-test tells the same story. Running it outside the container on desktop machine running macOS took about a minute. Running it inside the container took about two minutes.
On the laptop running Ubuntu, it took about half a minute outside and about a minute inside the container.
The speed improvement is so obvious, I’m seriously considering dual booting the desktop too.tags: code - linux - macos - photo