IFClite TypeScript API
    Preparing search index...

    Interface WorkerCountInputs

    Memory-budget-aware geometry worker count.

    Each parallel worker holds a WASM instance whose linear memory grows to roughly fileSize × 1.5 while building geometry. Spawning N workers therefore costs N × 1.5 × fileSize plus 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.

    interface WorkerCountInputs {
        cores: number;
        deviceMemoryGB: number;
        fileSizeMB: number;
        maxWorkers?: number;
        minWorkers?: number;
        totalJobs: number;
        workerCountOverride?: number;
    }
    Index
    cores: number

    navigator.hardwareConcurrency, 1+.

    deviceMemoryGB: number

    navigator.deviceMemory value (whole gigabytes; capped at 8 by browsers when telemetry-sensitive). When unknown, callers should pass 8.

    fileSizeMB: number

    File size in megabytes.

    maxWorkers?: number

    Upper bound on workers regardless of resources. Defaults to 8 to match the previous hard cap.

    minWorkers?: number

    Lower bound on workers. Defaults to 1 — never returns 0 when there are jobs to do.

    totalJobs: number

    Total geometry jobs the pre-pass discovered. Workers can't exceed this.

    workerCountOverride?: number

    Explicit 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.