iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🍣

npm vs pnpm vs yarn vs Bun Benchmarks for textlint

に公開

Note: I am a total "novice" in the JavaScript world, so please keep that in mind when reading this article.

Introduction

I have been using a certain VS Code extension for proofreading development documents until now. However, if I want to properly integrate it into CI, I cannot keep using it.

So, I finally decided to introduce textlint.

With that, the question arises: what should I do about the package manager?

Since I have lived under the ".NET Unified Theory" until now, I haven't properly introduced a JavaScript-related execution environment itself.

Therefore, I decided to conduct a benchmark as part of choosing a package manager just for running textlint.

Of course, there are aspects other than performance, so please use this just as a reference.

Benchmark Environment

  • OS: Windows 11
  • Hardware
    • AMD Ryzen 9 7950X (16C/32T)
    • 95.1GB RAM
    • SSD NVMe (WD_BLACK SN850X 2TB)
  • Software
    • Node.js v24.12.0 (LTS)
    • pnpm v10.27.0
    • npm v11.6.2
    • yarn v4.12.0
    • Bun v1.3.5
    • textlint v14.8.4

Benchmark Target

I targeted a relatively large repository with Markdown files.

  • Number of files: approx. 1,000
  • File size: approx. 4MB
  • Character count: approx. 2.7 million

Benchmark Methodology

  • Measure the elapsed time (ms) until process completion by executing textlint after installing the same dependencies using four types of JavaScript package managers (npm / Yarn / pnpm / Bun).
  • The processes to be measured are the following three: "Dependency installation", "Checking with textlint (lint:text)", and "Automatic correction with textlint (lint:text:fix)".
  • Measurements for each package manager are conducted once in sequence; this counts as one cycle, and a total of three cycles are repeated (to minimize bias caused by load fluctuations over time).

Benchmark Results

Well... maybe anything is fine? Considering security issues, maybe pnpm?

runtime stage avg_ms min_ms max_ms
npm install 3,416 3,280 3,590
bun install 3,933 2,121 7,133
yarn install 5,007 4,608 5,426
pnpm install 5,307 3,015 9,560
npm lint:text 19,503 19,414 19,580
yarn lint:text 19,549 18,771 20,383
bun lint:text 20,039 19,810 20,316
pnpm lint:text 21,729 21,585 21,940
bun lint:text:fix 27,061 26,635 27,417
npm lint:text:fix 27,068 26,778 27,410
yarn lint:text:fix 27,923 26,643 30,439
pnpm lint:text:fix 28,531 27,423 30,578

Discussion