-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jlong145
committed
Oct 17, 2024
1 parent
e5e2480
commit 5868536
Showing
2 changed files
with
17 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import { InstanceWrapper, WorkerDefinition } from "../src/mod.ts"; | |
import { existsSync } from "https://deno.land/std/fs/mod.ts"; | ||
import * as path from "https://deno.land/[email protected]/path/mod.ts"; | ||
import { readAllSync } from "https://deno.land/std/io/read_all.ts"; | ||
|
||
class TestExample extends WorkerDefinition { | ||
public constructor() { | ||
super(); | ||
|
@@ -23,6 +24,8 @@ Deno.bench("Wasm Worker Start Go Module loading", { | |
group: "non imported initalization", | ||
}, async (_b) => { | ||
const example = new TestExample(); | ||
const wasmLibPath = path.join(Deno.cwd(), "lib", "wasm_exec_tiny.js"); | ||
const wasmModulePath = path.join(Deno.cwd(), "examples", "wasm", "tiny-go", "primes-2.wasm"); | ||
|
||
const wrapper: InstanceWrapper<TestExample> = new InstanceWrapper< | ||
TestExample | ||
|
@@ -32,9 +35,9 @@ Deno.bench("Wasm Worker Start Go Module loading", { | |
outputPath: "output", | ||
namespace: "testing", | ||
addons: [ | ||
"./lib/wasm_exec_tiny.js", | ||
wasmLibPath, | ||
], | ||
modulePath: "./examples/wasm/tiny-go/primes-2.wasm", | ||
modulePath: wasmModulePath, | ||
addonLoader: (path: string) => { | ||
return Deno.readTextFileSync(path); | ||
}, | ||
|
@@ -57,7 +60,8 @@ Deno.bench("Wasm Worker Start Rust Module loading", { | |
group: "non imported initalization", | ||
}, async (_b) => { | ||
const example = new TestExample(); | ||
|
||
const wasmLibPath = path.join(Deno.cwd(), "lib", "wasm_test.js"); | ||
const wasmModulePath = path.join(Deno.cwd(), "examples", "wasm", "rust", "wasm_test_bg.wasm"); | ||
const wrapper: InstanceWrapper<TestExample> = new InstanceWrapper< | ||
TestExample | ||
>( | ||
|
@@ -66,9 +70,9 @@ Deno.bench("Wasm Worker Start Rust Module loading", { | |
outputPath: "output", | ||
namespace: "asd", | ||
addons: [ | ||
"./lib/wasm_test.js", | ||
wasmLibPath | ||
], | ||
modulePath: "./examples/wasm/rust/wasm_test_bg.wasm", | ||
modulePath: wasmModulePath, | ||
addonLoader: (path: string) => { | ||
return Deno.readTextFileSync(path); | ||
}, | ||
|
@@ -90,6 +94,8 @@ Deno.bench("Wasm Worker Start Rust Module loading", { | |
Deno.bench("Wasm Worker Start Code Gen Bootstrapping Rust", { | ||
group: "imported initalization", | ||
}, async (_b) => { | ||
const wasmLibPath = path.join(Deno.cwd(), "lib", "wasm_test.js"); | ||
const wasmModulePath = path.join(Deno.cwd(), "examples", "wasm", "rust", "wasm_test_bg.wasm"); | ||
if (!existsSync("./public")) { | ||
Deno.mkdirSync("./public"); | ||
} | ||
|
@@ -108,9 +114,9 @@ Deno.bench("Wasm Worker Start Code Gen Bootstrapping Rust", { | |
outputPath: "./public/bench", | ||
namespace: "asd", | ||
addons: [ | ||
"./lib/wasm_test.js", | ||
wasmLibPath, | ||
], | ||
modulePath: "./examples/wasm/rust/wasm_test_bg.wasm", | ||
modulePath: wasmModulePath, | ||
addonLoader: (path: string) => { | ||
return Deno.readTextFileSync(path); | ||
}, | ||
|