navigator.hardwareConcurrency, 1+.
navigator.deviceMemory value (whole gigabytes; capped at 8 by browsers
when telemetry-sensitive). When unknown, callers should pass 8.
File size in megabytes.
OptionalmaxUpper bound on workers regardless of resources. Defaults to 8 to match the previous hard cap.
OptionalminLower bound on workers. Defaults to 1 — never returns 0 when there are jobs to do.
Total geometry jobs the pre-pass discovered. Workers can't exceed this.
OptionalworkerExplicit worker count requested by the host (e.g. the viewer's
?geomWorkers=N A/B knob). When set, it overrides the cores-tier
heuristic — but is STILL clamped to the memory budget, job count, and
maxWorkers, because OOM is never a valid tuning outcome. Undefined ⇒
use the heuristic. Lets a user measure their host's true thermal optimum,
which is machine-specific and can't be hard-coded.
Memory-budget-aware geometry worker count.
Each parallel worker holds a WASM instance whose linear memory grows to roughly
fileSize × 1.5while building geometry. Spawning N workers therefore costsN × 1.5 × fileSizeplus the main-thread footprint (original buffer + SAB + accumulating mesh data ≈fileSize × 2.5).The previous heuristic only looked at core count, so a 16-core / 32 GB desktop loading a 1 GB file would spawn 8 workers and OOM. The fix is to cap worker count by available RAM after subtracting an OS/browser headroom and the main-thread budget.