Skip to content

Commit

Permalink
fixes to bechmarks and README
Browse files Browse the repository at this point in the history
jlong145 committed Jan 2, 2024
1 parent 53e9543 commit 4d235a4
Showing 2 changed files with 41 additions and 8 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -20,14 +20,16 @@ the bridge exports all wrapper functions for the given definition.
It's also possible to declare a `Web Assembly` file which can be interfaced with
with in the worker context.

Currently supports
- `Golang`
- `Rust`
Currently supports

compiled WASM. Support will be added for WASM
compiled and instated through module exports shall be added.
- `Golang`
- `Rust`

**note** when compiling rust through `wasm bidgen` only `--target web` is known to be supported.
compiled WASM. Support will be added for WASM compiled and instated through
module exports shall be added.

**note** when compiling rust through `wasm bidgen` only `--target web` is known
to be supported.

_Under development, still largely a work in progress_ Should not be used in
production.
35 changes: 33 additions & 2 deletions benchmark/wasm_instance_start_bench.ts
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ class TestExample extends WasmWorkerDefinition {
}
}

Deno.bench("Wasm Worker Start", (b) => {
Deno.bench("Wasm Worker Start Go Module loading", async (b) => {
const example: WasmWorkerDefinition = new TestExample(
"./examples/wasm/tiny-go/primes-2.wasm",
);
@@ -48,7 +48,38 @@ Deno.bench("Wasm Worker Start", (b) => {
},
},
);
wrapper.start().then(() => {
await wrapper.start().then(() => {
example.terminateWorker();
});
});

Deno.bench("Wasm Worker Start Rust Module loading", async (b) => {
const example: WasmWorkerDefinition = new TestExample(
"./examples/wasm/rust/wasm_test_bg.wasm",
);

const wrapper: WasmInstanceWrapper<TestExample> = new WasmInstanceWrapper<
Example
>(
example,
{
outputPath: "output",
namespace: "asd",
addons: [
"./lib/wasm_test.js",
],
addonLoader: (path: string) => {
return Deno.readTextFileSync(path);
},
moduleLoader: (path: string) => {
const fd = Deno.openSync(path);
let mod = Deno.readAllSync(fd);
fd.close();
return mod;
},
},
);
await wrapper.start().then(() => {
example.terminateWorker();
});
});

0 comments on commit 4d235a4

Please sign in to comment.