macOS vs Ubuntu Linux
`npm ci` & `npm run selenium-test` with and without Fresh


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.

MachineProcessorRAM (GB)OSDockerDocker ComposeFreshNode.jsnpmMediaWiki
iMac 13,2 (27-inch, 2012)3,2 GHz Quad-Core Intel Core i516macOS 10.15.720.
MacBook Air 6,1 (11-inch, 2014)1,4 GHz Dual-Core Intel Core i54macOS 11.3.1
Ubuntu 21.04


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

ubuntu.png (768×1 px, 290 KB)

Air + macOS + Fresh + npm run selenium-test

macos.png (768×1 px, 444 KB)

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.

ram.png (371×600 px, 7 KB)


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

Runnpm ci (m)npm run selenium-test (m)

iMac + macOS + Fresh

Runnpm ci (m)npm run selenium-test (m)

Air + macOS

Runnpm ci (m)npm run selenium-test (m)

Air + macOS + Fresh

Runnpm ci (m)npm run selenium-test (m)

Air + Ubuntu

Runnpm ci (m)npm run selenium-test (m)

Air + Ubuntu + Fresh

Runnpm ci (m)npm run selenium-test (m)


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.

speed.png (371×600 px, 15 KB)

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.

Written by zeljkofilipin on May 18 2021, 1:36 PM.
Senior Software Engineer in Test (Contractor)
valerio.bozzolan, Leaderboard
"Like" token, awarded by valerio.bozzolan."Like" token, awarded by Frostly.

Event Timeline

You should also include WSL (by dual-booting the iMac/Macbook Air). That's a killer Windows 10 feature that I think is being underreported.

(Summary for my local newspaper. Feel free to re-use!)

Experts agree: finally, macOS as good as Internet Explorer 🐌

Flash news! Apple's macOS 🍎 is now able to lower ⏬ your productivity by a 1400% factor.

We interviewed the first who passed:

«Leeenocs? 🐧 Don't trust that. These suspicious people 🕵🏻 using LibreOffice 💾. They won't know how to use Flash Player so imagine if they do charts. You know macOS is the most powerful stuff ever created by Egyptians and moreover, my cousin says it's safer because only Apple knows how to fix their problems on your laptop. Now sorry but I have to finish reading my Apple End of user agreeement. Anyway Leeeenocs sucks. Really. By!»
― Poldo

Ah-Ah! Thank you Poldo!

NOTE: In the meantime that Poldo has finished the sentence, we have compiled the whole project. Twice. To be honest, we also tried Ubuntu, Fedora and Debian GNU/Hurd with a virtual machine and compiled also from there. We didn't follow Poldo's speech very much. Sorry Poldo.