Working with front-end tools on Linux and Windows: the grand performance test

Is node.js really slower on Windows? How does using yarn instead of npm impact your workflow? Does the real-time antivirus affect your building time? Let me try to answer this questions with a quick benchmark and real, experimentally gathered numbers.

I always considered myself far from being religious in the field of operating systems, platforms and browsers. Obviously, I tend to have some preference — but I try to avoid fiercely shoving it into discussion. Someone uses Linux? Cool, if it’s good for them. Windows? Great, maybe they just like the experience. MacOS? I don’t mind. Firefox? Opera? Chrome? It’s okay.

Speaking of operating systems, preference is rarely a matter of performance — usually it’s a thing of convenience, details and aesthetics. Obviously one would say that macOS is blazingly fast — but it’s mostly a result of precisely selected high-performance hardware used byMac/MacBook platform.

Since I’m working with various projects and tools in order to solve problems of my team colleagues, I tend to switch my work environment pretty frequently: part of my job is being done using MacBook with macOS, some portions are being done on Windows, from time to time I’m jumping to Linux. And usually, I didn’t see any significant difference.

Yet, a few months ago, I started to feel a little… itch. I’ve experienced a feeling that performance of front-end development tools based on node.js is being constrained on Windows environment. It was okay to work, yet I couldn’t get rid of sense that npm , node , yarn and similar tools are working… slower than on linux/macOS systems. Apparently I wasn’t alone — there were several reports of similar experiences, but without proper conclusions.

Curiosity took over and I’ve ended up in running some numbers.

Results were unambiguous. Bear with me through this article to see what did I discover.

Method

Main goal was to compare Windows and Linux performance-wise, testing them on the most common scenarios:

scaffolding new web application

installing node dependencies

creating the bundle, i.e. building the web app

There was a plan to include macOS in tests as well, but I didn’t get a chance to have natively run Windows and macOS on the same piece of hardware. It ended up in comparing performance on two popular systems:

Windows 10 Pro (build 1809, October 2018 update)

(build 1809, October 2018 update) Ubuntu 18.04.2 LTS running Linux 5.0.0–23 kernel

While selecting technologies that will serve the best benchmark value, I’ve reached out to React with TypeScript and Webpack (coming from create-react-app bundle). Also, I’ve decided to test both NPM and yarn in terms of dependency management. Building time was tested not only against a small number of files, but with hundreds as well. I’ve ended up in designing benchmark outline consisting of the following steps:

Scaffold the app using create-react-app with TypeScript enabled (benchmark #1) Reset the dependencies (remove node_modules) and eject the configuration Install dependencies:

using npm install while retaining package-lock.json (benchmark #2)

using npm install while removing package-lock.json on each run (benchmark #3)

on each run using yarn while retaining yarn.lock (benchmark #4)

using yarn install while removing yarn.lock on each run (benchmark #5)

4. Build the scaffolded app: