]> zoso.dev Git - libnemo.git/commitdiff
Post work as it is calculated to testing page.
authorChris Duncan <chris@zoso.dev>
Sat, 21 Dec 2024 16:08:17 +0000 (08:08 -0800)
committerChris Duncan <chris@zoso.dev>
Sat, 21 Dec 2024 16:08:17 +0000 (08:08 -0800)
index.html

index bdd7fb32caaf3ff267f7917af95b9969c6f7b297..0611473b88667e81a3111c831cdf8a919879108b 100644 (file)
@@ -6,7 +6,7 @@
        <script type="module">
                (async () => {
                        const times = []
-                       const works = []
+                       const works = document.getElementById('works')
                        const block = new libnemo.SendBlock(
                                'nano_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx',
                                '11618869000000000000000000000000',
@@ -20,7 +20,7 @@
                                await block.pow()
                                const end = performance.now()
                                times.push(end - start)
-                               works.push(block.work)
+                               works.textContent += `${block.work} `
                                console.log(block.work)
                        }
                        let sum = 0, reciprocals = 0, product = 1, count = times.length
@@ -34,8 +34,6 @@
 Average: ${sum / count} ms
 Harmonic: ${count / reciprocals} ms
 Geometric: ${Math.pow(product, 1 / count)} ms`
-                       const w = document.getElementById('works')
-                       works.forEach(v => { w.textContent += v })
                })()
        </script>
        <style>body{background:black;color:white;}</style>