change script threads to hardwareconcurrency/2 instead of -1, because it can still cause browsers to be sluggish or crash moreso on powerful machines

This commit is contained in:
Thomas Lynch
2021-11-27 01:02:37 +11:00
parent 6d9ec35d9d
commit 876d0835bc

View File

@ -13,7 +13,7 @@ if (window.Worker) {
const challenge = document.querySelector('[data-pow]').dataset.pow; const challenge = document.querySelector('[data-pow]').dataset.pow;
const difficulty = 0; const difficulty = 0;
const start = Date.now(); const start = Date.now();
const threads = window.navigator.hardwareConcurrency-1; const threads = Math.max(1,Math.floor(window.navigator.hardwareConcurrency/2));
let finished = false; let finished = false;
const messageHandler = (e) => { const messageHandler = (e) => {
if (finished) { return; } if (finished) { return; }