JavaScript 套件管理員基準測試
上次基準測試於:2024 年 4 月 21 日,上午 2:44(每日更新)。
此基準測試比較 npm、pnpm、Yarn Classic 和 Yarn PnP 的效能(請查看 Yarn 基準測試,了解未包含於此處的任何其他 Yarn 模式)。
以下簡要說明這些測試如何應用於現實世界
clean install
:執行全新安裝所需的時間:沒有鎖定檔、快取中沒有套件、沒有node_modules
資料夾。with cache
、with lockfile
、with node_modules
:完成第一次安裝後,再次執行安裝指令。with cache
、with lockfile
:當開發人員擷取儲存庫並首次執行安裝時。with cache
:與上述相同,但套件管理員沒有鎖定檔可使用。with lockfile
:當安裝在 CI 伺服器上執行時。with cache
、with node_modules
:刪除鎖定檔並再次執行安裝指令。with node_modules
、with lockfile
:刪除套件快取並再次執行安裝指令。with node_modules
:刪除套件快取和鎖定檔並再次執行安裝指令。update
:變更package.json
中的版本並再次執行安裝指令,以更新您的相依項。
大量檔案
應用程式的 package.json
在此
動作 | 快取 | 鎖定檔 | node_modules | npm | pnpm | Yarn | Yarn PnP |
---|---|---|---|---|---|---|---|
安裝 | 31.3 秒 | 9.9 秒 | 7.3 秒 | 3.6 秒 | |||
安裝 | ✔ | ✔ | ✔ | 1.5 秒 | 1 秒 | 5.2 秒 | 不適用 |
安裝 | ✔ | ✔ | 8 秒 | 2.5 秒 | 5.4 秒 | 1.4 秒 | |
安裝 | ✔ | 13.1 秒 | 6.4 秒 | 7.3 秒 | 3 秒 | ||
安裝 | ✔ | 11.8 秒 | 6.2 秒 | 5.4 秒 | 1.4 秒 | ||
安裝 | ✔ | ✔ | 1.7 秒 | 2.4 秒 | 6.9 秒 | 不適用 | |
安裝 | ✔ | ✔ | 1.4 秒 | 1 秒 | 5.2 秒 | 不適用 | |
安裝 | ✔ | 1.7 秒 | 6 秒 | 6.9 秒 | 不適用 | ||
更新 | 不適用 | 不適用 | 不適用 | 6.5 秒 | 3.7 秒 | 5.8 秒 | 3 秒 |