56

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

 4 years ago
source link: https://www.tuicool.com/articles/YbQVvqn
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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.

Aug 5 ·9min read

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 thing of convenience, details and aesthetics. Obviously one would say that macOS is blazingly fast — but it 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, starting a few months ago, I started to feel a little… itch. I’ve experienced a feeling that performance of front-end development tooling 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 found.

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)
  • 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:

  1. Scaffold the app using create-react-app with TypeScript enabled (benchmark #1)
  2. Reset the dependencies (remove node_modules) and eject the configuration
  3. 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)
  • 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:

  • having small number (3) of source files (benchmark #6)
  • having large number (300+) of source files (benchmark #7)

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK