You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example uses [`jz`](https://www.npmjs.com/package/jz) to compile a small JavaScript-subset numeric kernel to WebAssembly and run it inside EdgeJS.
4
+
5
+
The primary path is a pure scalar module: `compile()` returns WebAssembly bytes, `WebAssembly.Module.imports()` is empty, and EdgeJS runs the module through the standard WebAssembly API. `index.mjs` also includes a small explicit host-import sample that passes a `console`-like object through `imports`; this is useful for diagnostics without requiring implicit runtime imports.
6
+
7
+
JZ is useful for hot numeric, DSP, parser, and typed-array kernels. It is not a general JavaScript runtime or a Node.js compatibility layer; EdgeJS remains the runtime.
8
+
9
+
Install the example dependency:
10
+
11
+
```bash
12
+
npm install
13
+
```
14
+
15
+
Run the smoke example:
16
+
17
+
```bash
18
+
edge index.mjs
19
+
```
20
+
21
+
Run the checksum benchmark. The benchmark uses a small `Float64Array` 4x4 matrix kernel and calls one compiled export that owns the hot loop, so it measures generated WebAssembly work rather than repeated JS-to-WASM call overhead.
22
+
23
+
```bash
24
+
edge bench.mjs
25
+
```
26
+
27
+
The benchmark prints matching checksums, WebAssembly import count, generated byte size, and median timings. Tune the workload with `ITERATIONS`, `WARMUP`, and `RUNS`.
28
+
29
+
When working from a local EdgeJS checkout, replace `edge` with `../../build-edge/edge` after running `make build`.
0 commit comments