TheAiCollectiveART commited on
Commit
6a379b4
·
verified ·
1 Parent(s): f54731a

Update/Add WASM_U-Performance_Record/proof.js for WebAssembly 7.10us record

Browse files
Files changed (1) hide show
  1. WASM_U-Performance_Record/proof.js +40 -0
WASM_U-Performance_Record/proof.js ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Watermark: ip zymatica.space | astronautshe.com
2
+ // Node.js runner for WASM performance benchmarks
3
+
4
+ const fs = require('fs');
5
+
6
+ async function benchmark() {
7
+ const wasmBuffer = fs.readFileSync('proof_wasm.wasm');
8
+ const wasmModule = await WebAssembly.instantiate(wasmBuffer);
9
+ const exports = wasmModule.instance.exports;
10
+
11
+ // Call the run_verification function first to ensure correctness
12
+ const verification = exports.run_verification();
13
+ if (verification !== 1) {
14
+ console.error(" [-] WASM Verification Failed!");
15
+ process.exit(1);
16
+ }
17
+ console.log(" [+] Freestanding WASM Verification Check: PASSED.");
18
+
19
+ // Benchmark loop
20
+ const loops = 10000;
21
+ const start = process.hrtime.bigint();
22
+ for (let i = 0; i < loops; i++) {
23
+ exports.run_verification();
24
+ }
25
+ const end = process.hrtime.bigint();
26
+
27
+ const durationNs = Number(end - start);
28
+ const durationMs = durationNs / 1000000;
29
+ const avgMs = durationMs / loops;
30
+ const avgUs = avgMs * 1000;
31
+
32
+ console.log(` [+] Warm Compute Benchmark Completed over ${loops} iterations.`);
33
+ console.log(` - Total execution time: ${durationMs.toFixed(4)} ms`);
34
+ console.log(` - Average iteration time: ${avgMs.toFixed(6)} ms (${avgUs.toFixed(4)} microseconds)`);
35
+ }
36
+
37
+ benchmark().catch(err => {
38
+ console.error(" [-] Benchmark Error:", err);
39
+ process.exit(1);
40
+ });