} from './utility-types'
export type { CircularArray } from './circular-array'
export type { Queue } from './queue'
+export { availableParallelism } from './utils'
+import os from 'node:os'
import type {
MeasurementStatisticsRequirements,
WorkerChoiceStrategyOptions
median: false
}
+/**
+ * Safe helper to get the host OS optimized maximum pool size.
+ */
+export const availableParallelism = (): number => {
+ let availableParallelism = 1
+ try {
+ availableParallelism = os.availableParallelism()
+ } catch {
+ const cpus = os.cpus()
+ if (Array.isArray(cpus) && cpus.length > 0) {
+ availableParallelism = cpus.length
+ }
+ }
+ return availableParallelism
+}
+
/**
* Compute the median of the given data set.
*