mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-28 02:53:15 -04:00
perf: default network-concurrency to cpu count (#7285)
* feat: default network-concurrency to cpu count It was found that setting network-concurrency to the exact number of CPU cores gives fastest installation * perf: set 16 as min default concurrency * docs: add comment --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
6
.changeset/small-eels-cry.md
Normal file
6
.changeset/small-eels-cry.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/resolve-dependencies": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
(Important) Increased the default amount of allowed concurrent network request on systems that have more than 16 CPUs [#7285](https://github.com/pnpm/pnpm/pull/7285).
|
||||
@@ -237,6 +237,7 @@
|
||||
"testcase",
|
||||
"todomvc",
|
||||
"tsparticles",
|
||||
"underperformance",
|
||||
"undollar",
|
||||
"uninstallation",
|
||||
"unnest",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { createReadStream, promises as fs } from 'fs'
|
||||
import os from 'os'
|
||||
import path from 'path'
|
||||
import {
|
||||
type FileType,
|
||||
@@ -97,7 +98,10 @@ export function createPackageRequester (
|
||||
} {
|
||||
opts = opts || {}
|
||||
|
||||
const networkConcurrency = opts.networkConcurrency ?? 16
|
||||
// A lower bound of 16 is enforced to prevent performance degradation,
|
||||
// especially in CI environments. Tests with a threshold lower than 16
|
||||
// have shown consistent underperformance.
|
||||
const networkConcurrency = opts.networkConcurrency ?? Math.max(os.cpus().length, 16)
|
||||
const requestsQueue = new PQueue({
|
||||
concurrency: networkConcurrency,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user