From 0af698fa452e6a0d23baf869df897326a1836ba9 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sun, 22 Dec 2024 10:44:50 -0800 Subject: [PATCH] Fix appending to innerHTML. Add per-work times to output. --- index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 3729158..698fbd0 100644 --- a/index.html +++ b/index.html @@ -21,7 +21,7 @@ await block.pow() const end = performance.now() times.push(end - start) - works.innerHTML += `${block.work}
` + works.innerHTML += `${block.work} (${end - start} ms)
` console.log(block.work) } let sum = 0, reciprocals = 0, product = 1, count = times.length @@ -48,7 +48,7 @@ Geometric: ${Math.pow(product, 1 / count)} ms` }) const end = performance.now() times.push(end - start) - works.innerHTML += `${work}
` + works.innerHTML += `${work} (${end - start} ms)
` console.log(work) } let sum = 0, reciprocals = 0, product = 1, count = times.length @@ -58,10 +58,10 @@ Geometric: ${Math.pow(product, 1 / count)} ms` product *= times[i] } const t = document.getElementById('times') - t.innerHTML = `Total: ${sum} ms
+ t.innerHTML += `Total: ${sum} ms
Average: ${sum / count} ms
Harmonic: ${count / reciprocals} ms
-Geometric: ${Math.pow(product, 1 / count)} ms` +Geometric: ${Math.pow(product, 1 / count)} ms
` })() -- 2.34.1