]> zoso.dev Git - libnemo.git/commitdiff
Fix appending to innerHTML. Add per-work times to output.
authorChris Duncan <chris@zoso.dev>
Sun, 22 Dec 2024 18:44:50 +0000 (10:44 -0800)
committerChris Duncan <chris@zoso.dev>
Sun, 22 Dec 2024 18:44:50 +0000 (10:44 -0800)
index.html

index 37291583a314da31f3bfe3f19f02340568c8ab72..698fbd0a08640b908c6a637c1193e24b672aae3a 100644 (file)
@@ -21,7 +21,7 @@
                                await block.pow()
                                const end = performance.now()
                                times.push(end - start)
-                               works.innerHTML += `${block.work}<br/>`
+                               works.innerHTML += `${block.work} (${end - start} ms)<br/>`
                                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}<br/>`
+                                       works.innerHTML += `${work} (${end - start} ms)<br/>`
                                        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<br/>
+                               t.innerHTML += `Total: ${sum} ms<br/>
 Average: ${sum / count} ms<br/>
 Harmonic: ${count / reciprocals} ms<br/>
-Geometric: ${Math.pow(product, 1 / count)} ms`
+Geometric: ${Math.pow(product, 1 / count)} ms<br/>`
                        })()
 
        </script>