mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
Rolldown defaults to 1.5x physical cores Tokio workers plus a Rayon pool per logical CPU (24+24 here). Capping both at 8 on >8-core hosts cuts electron-vite build CPU 24% with byte-identical output. pnpm dev no longer blocks on a stale pairing web build; it stages into out/.web-next and swaps on success. Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
17 lines
618 B
JavaScript
17 lines
618 B
JavaScript
import os from 'node:os'
|
|
|
|
// Measured on 24 threads: Rolldown's default 24+24 workers cost ~25% more CPU than 8 for no wall-time gain.
|
|
const maxRolldownThreads = '8'
|
|
|
|
/** Caps Rolldown's Tokio and Rayon pools on large hosts unless the caller already chose sizes. */
|
|
export function withRolldownThreadLimit(env, availableParallelism = os.availableParallelism()) {
|
|
if (availableParallelism <= Number(maxRolldownThreads)) {
|
|
return env
|
|
}
|
|
return {
|
|
...env,
|
|
ROLLDOWN_WORKER_THREADS: env.ROLLDOWN_WORKER_THREADS ?? maxRolldownThreads,
|
|
RAYON_NUM_THREADS: env.RAYON_NUM_THREADS ?? maxRolldownThreads
|
|
}
|
|
}
|