]> zoso.dev Git - libnemo.git/commitdiff
Per typescript, navigator.hardwareConcurrency is never null, so lose the fallback...
authorChris Duncan <chris@zoso.dev>
Tue, 3 Dec 2024 23:23:36 +0000 (15:23 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 3 Dec 2024 23:23:36 +0000 (15:23 -0800)
src/lib/pool.ts

index 5cafabd4c2b2a2756e9d001780e0fd50efdcd24b..5524879b3dc68fb7fb4271a01e72950cfd09e63a 100644 (file)
@@ -19,7 +19,7 @@ type Thread = {
 */
 export class Pool {
        #approach: 'converge' | 'divide' = 'divide'
-       #cores: number = Math.max(1, (navigator.hardwareConcurrency || 1) - 1)
+       #cores: number = Math.max(1, Math.floor(navigator.hardwareConcurrency * 0.8))
        #queue: object[] = []
        #resolve: Function = (value: unknown): void => { }
        #results: object[] = []