]> zoso.dev Git - libnemo.git/commitdiff
Delete performance and console logging in Pow.
authorChris Duncan <chris@zoso.dev>
Tue, 24 Dec 2024 08:06:08 +0000 (00:06 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 24 Dec 2024 08:06:08 +0000 (00:06 -0800)
src/lib/workers/powgl.ts

index af0f312c1b1c8956fe5a42e76332f255e06edee6..ed90f29fec0e4b1f666a487a812dba076df05f77 100644 (file)
@@ -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],