From: Chris Duncan Date: Tue, 4 Mar 2025 01:51:48 +0000 (-0800) Subject: Remove logging from CPU version since it would generate way too much information... X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=879e9f714afd0ac2797b01e8fe4d05e1c0697557;p=nano-pow.git Remove logging from CPU version since it would generate way too much information to be performant. --- diff --git a/src/classes/cpu.ts b/src/classes/cpu.ts index 55e6d24..d3690bb 100644 --- a/src/classes/cpu.ts +++ b/src/classes/cpu.ts @@ -113,7 +113,6 @@ export class NanoPowCpu { } static #hash (seed: bigint, hash: string): bigint { - if (this.#debug) console.log(`hash: ${hash}`) // Reset buffers before each calculation for (let i = 0; i < 8; i++) { this.#v[i] = this.#blake2b_IV[i] @@ -127,12 +126,10 @@ export class NanoPowCpu { // Set up input buffers this.#mView.setBigUint64(0, seed, true) - if (this.#debug) console.log(`seed: ${this.#m[0].toString(16).padStart(16, '0')} (${this.#m[0]})`) for (let i = 0; i < hash.length; i += 16) { const u64 = hash.slice(i, i + 16) this.#mView.setBigUint64(i / 2 + 8, BigInt(`0x${u64}`)) } - if (this.#debug) console.log('m', this.#m) for (let r = 0; r < 12; r++) { const s = this.#blake2b_sigma[r] @@ -181,7 +178,6 @@ export class NanoPowCpu { const random1 = Math.floor(Math.random() * 0xffffffff) nonce = (BigInt(random0) << 32n) | BigInt(random1) result = this.#hash(nonce, hash) - if (attempts % 1000000n === 0n) console.log(`${attempts} attempts`) } while (result < threshold) console.log(performance.now() - start) this.#busy = false