fix(engine): render work is sized by the CPUs the process may use (#7612)

* fix(engine): render work is sized by the CPUs the process may use

* fix(engine): keep the usable CPU count comment under the line limit
This commit is contained in:
Miguel Ángel
2026-11-12 17:07:45 +00:00
committed by GitHub
parent 83b34cbe49
commit 395c845cd3
18 changed files with 105 additions and 37 deletions
@@ -1,4 +1,4 @@
import { availableParallelism } from "node:os";
import { usableCpuCount } from "./systemMemory.js";
export const X265_MAX_THREADS = 16;
@@ -6,7 +6,7 @@ export const X265_MAX_THREADS = 16;
export function appendSoftwareEncoderThreadsArg(
args: string[],
encoder: "libx264" | "libx265",
parallelism: number = availableParallelism(),
parallelism: number = usableCpuCount(),
): void {
const cap = encoder === "libx265" ? X265_MAX_THREADS : Infinity;
args.push("-threads", String(Math.min(cap, Math.max(1, Math.floor(parallelism)))));