Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: limit workspace project concurrency to available cores #6869

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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