Better default worker count value

This commit is contained in:
Tyler Hallada 2022-03-04 23:56:36 -05:00
parent 05a780c4a9
commit 1b48c34974

View File

@ -24,7 +24,7 @@ export class WorkerPool {
this.availableWorkers = []; this.availableWorkers = [];
} }
public async init(count: number = 8): Promise<WorkerPool> { public async init(count: number = window.navigator.hardwareConcurrency ?? 8): Promise<WorkerPool> {
this.availableWorkers = []; this.availableWorkers = [];
for (let i = 0; i < count; i++) { for (let i = 0; i < count; i++) {
this.availableWorkers.push(await this.createWorker()); this.availableWorkers.push(await this.createWorker());