Skip to content

Commit

Permalink
perf: limit workspace project concurrency to available cores (#6869)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va authored Nov 7, 2024
1 parent b21cdce commit f4c04ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vitest/src/node/workspace/resolveWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Vitest } from '../core'
import type { UserConfig, UserWorkspaceConfig, WorkspaceProjectConfiguration } from '../types/config'
import type { WorkspaceProject } from '../workspace'
import { existsSync, promises as fs } from 'node:fs'
import os from 'node:os'
import { limitConcurrency } from '@vitest/runner/utils'
import fg from 'fast-glob'
import { relative, resolve } from 'pathe'
Expand Down Expand Up @@ -51,7 +52,7 @@ export async function resolveWorkspace(

const projectPromises: Promise<WorkspaceProject>[] = []
const fileProjects = [...configFiles, ...nonConfigDirectories]
const concurrent = limitConcurrency(5)
const concurrent = limitConcurrency(os.availableParallelism?.() || os.cpus().length || 5)

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

0 comments on commit f4c04ab

Please sign in to comment.