From ddec9cf2faa774fd12a3b9cc0f1414198e52baa8 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 12 Dec 2017 23:06:13 +0100 Subject: [PATCH] only run crypto worker on half of available threads --- src/crypto/cryptoApi.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/crypto/cryptoApi.ts b/src/crypto/cryptoApi.ts index 9a21d13a9..12b1c9708 100644 --- a/src/crypto/cryptoApi.ts +++ b/src/crypto/cryptoApi.ts @@ -203,6 +203,7 @@ export class CryptoApi { // only works in the browser // tslint:disable-next-line:no-string-literal concurrency = (navigator as any)["hardwareConcurrency"]; + concurrency = Math.max(1, Math.ceil(concurrency / 2)); } catch (e) { // ignore }