Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

618 B
Raw Blame
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
  }
}