]> zoso.dev Git - libnemo.git/commitdiff
Start building out visible content in testing webpage.
authorChris Duncan <chris@zoso.dev>
Sat, 21 Dec 2024 16:06:16 +0000 (08:06 -0800)
committerChris Duncan <chris@zoso.dev>
Sat, 21 Dec 2024 16:06:16 +0000 (08:06 -0800)
index.html
perf/log [deleted file]

index 73dd084e8db0e8c27845afe2e6a752bca4932c0f..bdd7fb32caaf3ff267f7917af95b9969c6f7b297 100644 (file)
@@ -3,9 +3,47 @@
 <head>
        <link rel="icon" href="./favicon.ico">
        <script type="module" src="./dist/global.min.js"></script>
-       <style>body{background:black;}</style>
+       <script type="module">
+               (async () => {
+                       const times = []
+                       const works = []
+                       const block = new libnemo.SendBlock(
+                               'nano_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx',
+                               '11618869000000000000000000000000',
+                               'nano_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p',
+                               '0',
+                               'nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou',
+                               '92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D'
+                       )
+                       for (let i = 0; i < 0x10; i++) {
+                               const start = performance.now()
+                               await block.pow()
+                               const end = performance.now()
+                               times.push(end - start)
+                               works.push(block.work)
+                               console.log(block.work)
+                       }
+                       let sum = 0, reciprocals = 0, product = 1, count = times.length
+                       for (let i = 0; i < count; i++) {
+                               sum += times[i]
+                               reciprocals += 1 / times[i]
+                               product *= times[i]
+                       }
+                       const t = document.getElementById('times')
+                       t.textContent = `Total: ${sum} ms
+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>
 </head>
 
-<body></body>
+<body>
+       <p id="times"></p>
+       <p id="works"></p>
+</body>
 
 </html>
diff --git a/perf/log b/perf/log
deleted file mode 100644 (file)
index 865242e..0000000
--- a/perf/log
+++ /dev/null
@@ -1,63 +0,0 @@
-SEND BLOCK
-
-start calculate: 155 c88dd903-db2a-4aa6-b394-f60167006006:1497:17
-color cleared: 230 c88dd903-db2a-4aa6-b394-f60167006006:1511:17
-starting first draw: 234 c88dd903-db2a-4aa6-b394-f60167006006:1782:17
-start readPixels: 264 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 305 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 308 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 348 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 351 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 394 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 402 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 444 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 446 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 485 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 488 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 525 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 528 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 568 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 571 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 609 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 612 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 650 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 656 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 695 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 698 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 736 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 738 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 778 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 781 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 819 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 821 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 858 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-start readPixels: 861 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 900 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-found: 903 c88dd903-db2a-4aa6-b394-f60167006006:1770:23
-
-Total: 900 ms block.perf.js:32:10
-Average: 900 ms block.perf.js:33:10
-Harmonic: 900 ms block.perf.js:34:10
-Geometric: 900 ms block.perf.js:35:10
-
-
-
-RECEIVE BLOCK
-
-start calculate: 905 c88dd903-db2a-4aa6-b394-f60167006006:1497:17
-color cleared: 960 c88dd903-db2a-4aa6-b394-f60167006006:1511:17
-starting first draw: 963 c88dd903-db2a-4aa6-b394-f60167006006:1782:17
-start readPixels: 969 c88dd903-db2a-4aa6-b394-f60167006006:1765:19
-end readPixels: 1008 c88dd903-db2a-4aa6-b394-f60167006006:1767:19
-found: 1008 c88dd903-db2a-4aa6-b394-f60167006006:1770:23
-
-
-Total: 104 ms block.perf.js:56:10
-Average: 104 ms block.perf.js:57:10
-Harmonic: 104 ms block.perf.js:58:10
-Geometric: 104 ms block.perf.js:59:10
-
-PASS  Time to calculate proof-of-work for a receive block 0x10 times GLOBALS.mjs:42:9
-TESTING COMPLETE main.mjs:8:8
-
-​