From: Chris Duncan Date: Tue, 24 Dec 2024 08:06:08 +0000 (-0800) Subject: Delete performance and console logging in Pow. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=9372f7b649599c2ed25730e74a333476feeb0e19;p=libnemo.git Delete performance and console logging in Pow. --- diff --git a/src/lib/workers/powgl.ts b/src/lib/workers/powgl.ts index af0f312..ed90f29 100644 --- a/src/lib/workers/powgl.ts +++ b/src/lib/workers/powgl.ts @@ -335,7 +335,6 @@ void main() { n++ if (Pow.#gl == null) throw new Error('WebGL 2 is required') if (Pow.#query == null) throw new Error('WebGL 2 is required to run queries') - performance.mark('start') crypto.getRandomValues(work) Pow.#gl.clear(Pow.#gl.COLOR_BUFFER_BIT) @@ -357,10 +356,6 @@ void main() { // A valid nonce was found readBackResult() } else { - performance.mark('end') - frameTimes.push(performance.measure('draw', 'start', 'end').duration) - performance.clearMarks() - performance.clearMeasures() // No valid nonce found, start the next draw call requestAnimationFrame(draw) } @@ -375,21 +370,12 @@ void main() { // Check the pixels for any success for (let i = 0; i < Pow.#pixels.length; i += 4) { if (Pow.#pixels[i] !== 0) { - performance.mark('end') - frameTimes.push(performance.measure('draw', 'start', 'end').duration) - performance.clearMarks() - console.log(`average frame time: ${(frameTimes.reduce((a, b) => a + b)) / frameTimes.length} ms`) - console.log(`frames calculated: ${n}`) let sum = 0, reciprocals = 0, product = 1, count = frameTimes.length for (let i = 0; i < count; i++) { sum += frameTimes[i] reciprocals += 1 / frameTimes[i] product *= frameTimes[i] } - console.log(`Total: ${sum} ms`) - console.log(`Average: ${sum / count} ms`) - console.log(`Harmonic: ${count / reciprocals} ms`) - console.log(`Geometric: ${Math.pow(product, 1 / count)} ms`) const hex = Pow.#hexify(work.subarray(4, 8)) + Pow.#hexify([ Pow.#pixels[i + 2], Pow.#pixels[i + 3],