Skip to content

Commit f4c04ab

Browse files
authoredNov 7, 2024··
perf: limit workspace project concurrency to available cores (#6869)
1 parent b21cdce commit f4c04ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎packages/vitest/src/node/workspace/resolveWorkspace.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Vitest } from '../core'
22
import type { UserConfig, UserWorkspaceConfig, WorkspaceProjectConfiguration } from '../types/config'
33
import type { WorkspaceProject } from '../workspace'
44
import { existsSync, promises as fs } from 'node:fs'
5+
import os from 'node:os'
56
import { limitConcurrency } from '@vitest/runner/utils'
67
import fg from 'fast-glob'
78
import { relative, resolve } from 'pathe'
@@ -51,7 +52,7 @@ export async function resolveWorkspace(
5152

5253
const projectPromises: Promise<WorkspaceProject>[] = []
5354
const fileProjects = [...configFiles, ...nonConfigDirectories]
54-
const concurrent = limitConcurrency(5)
55+
const concurrent = limitConcurrency(os.availableParallelism?.() || os.cpus().length || 5)
5556

5657
for (const filepath of fileProjects) {
5758
// if file leads to the root config, then we can just reuse it because we already initialized it

0 commit comments

Comments
 (0)
Please sign in to comment.