macOS vs Ubuntu Linux Part 2
by Željko Filipin
In macOS vs Ubuntu Linux I’ve written about a fun experiment. I’ve dual booted an MacBook Air with macOS and Ubuntu. Then, I ran the same npm scripts on both operating systems. To make things more interesting, I’ve ran the scripts both on the host operating system and inside a Docker container. Running scripts on Ubuntu was so faster, that I wanted to dual boot my iMac too. At the time, I could not dual boot the iMac because my disk refused to be partitioned. In the last couple of weeks, I’ve formatted disks on both machines and did a clean install of both macOS and Ubuntu. It’s time to run the experiment again!
For reference, here’s the table with the two machines and the Fresh container, with some relevant data.
|Machine||iMac 13,2 (27-inch, 2012)||MacBook Air 6,1 (11-inch, 2014)||Fresh|
|Processor||3,2 GHz Quad-Core Intel Core i5||1,4 GHz Dual-Core Intel Core i5|
|Linux||Ubuntu 21.04||Ubuntu 21.04||Debian 9 (stretch)|
I’ve left Docker settings at default values. Increasing resources available to Docker might speed things up on MacOS, but that’s a topic for another blog post.
For my reference, here are the default values in Docker Preferences > Resources on macOS.
|Disk image size||59.6 GB (4.5 GB used)|
Running the scripts
Similar to the previous blog post, I was running two npm scripts. Installing npm dependencies (
npm ci) and running tests (
npm run selenium-test). I’ve used MediaWiki Core repository (
npm ci) and it’s Selenium test suite (
npm run selenium-test). The suite is targeting a local MediaWiki site. The site is running in a local Docker container via MediaWiki-Docker.
I was not only interested in how fast it is to run the scripts from the operating system (macOS or Linux). I also wanted to know how much time it takes to run the scripts from a Fresh container. (Fresh is “a fast and ready-to-use Docker container with various developer tools pre-installed.”)
To make things as fair as possible, both machines were using the same Wi-Fi and were the same distance from the router.
npm run selenium-test was running in headless mode.
I’ve tried to keep the environments as simple as possible. When running the commands, only the Terminal application was open. 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 and seconds) each command took in different environments.
I made a mistake in the previous blog post on this topic by including all the data in the post. That’s too much data. This time, I’ll include only averages.
|Environment||npm ci (m:s)||npm run selenium-test (m:s)|
|iMac + Ubuntu||0:12||0:15|
|iMac + Ubuntu + Fresh||0:14||0:19|
|iMac + macOS||0:20||0:22|
|iMac + macOS + Fresh||2:25||1:02|
|Air + Ubuntu||0:13||0:17|
|Air + Ubuntu + Fresh||0:19||0:23|
|Air + macOS||0:36||0:47|
|Air + macOS + Fresh||4:04||1:54|
Chart by environment.
Chart by script.
As expected, running both scripts is much faster on Linux. Running the scripts is much slower on macOS+Fresh combination. The tiny laptop is running great on Linux!tags: code - linux - photo