Skip to content

Commit

Permalink
ref: small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jlong145 committed Oct 17, 2024
1 parent b67de6d commit 105f2ab
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion benchmark/hyperfine/parallel_perf_bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function parallelKeygenTest(opCount: number, workerCount: number) {
});
await wrapper.start();
// Only measure time of execution. we Init shouldnt count ;)

const promises = [];
for (let i = 0; i < opCount; i++) {
promises.push(example.execute("getKeyPair", {}));
Expand Down
30 changes: 24 additions & 6 deletions benchmark/wasm_instance_start_bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ Deno.bench("Wasm Worker Start Go Module loading", {
}, 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 wasmModulePath = path.join(
Deno.cwd(),
"examples",
"wasm",
"tiny-go",
"primes-2.wasm",
);

const wrapper: InstanceWrapper<TestExample> = new InstanceWrapper<
TestExample
Expand All @@ -37,7 +43,7 @@ Deno.bench("Wasm Worker Start Go Module loading", {
addons: [
wasmLibPath,
],
modulePath: wasmModulePath,
modulePath: wasmModulePath,
addonLoader: (path: string) => {
return Deno.readTextFileSync(path);
},
Expand All @@ -61,7 +67,13 @@ Deno.bench("Wasm Worker Start Rust Module loading", {
}, 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 wasmModulePath = path.join(
Deno.cwd(),
"examples",
"wasm",
"rust",
"wasm_test_bg.wasm",
);
const wrapper: InstanceWrapper<TestExample> = new InstanceWrapper<
TestExample
>(
Expand All @@ -70,9 +82,9 @@ Deno.bench("Wasm Worker Start Rust Module loading", {
outputPath: "output",
namespace: "asd",
addons: [
wasmLibPath
wasmLibPath,
],
modulePath: wasmModulePath,
modulePath: wasmModulePath,
addonLoader: (path: string) => {
return Deno.readTextFileSync(path);
},
Expand All @@ -95,7 +107,13 @@ 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");
const wasmModulePath = path.join(
Deno.cwd(),
"examples",
"wasm",
"rust",
"wasm_test_bg.wasm",
);
if (!existsSync("./public")) {
Deno.mkdirSync("./public");
}
Expand Down
2 changes: 1 addition & 1 deletion src/Pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class Pool {

findWorkerForId = (id: string): WorkerHandler | undefined => {
for (let i = 0; i < this.threads.length; i++) {
if (this.threads[i]._executionMap[id]) {
if (Object.keys(this.threads[i]._executionMap).indexOf(id) > -1) {
return this.threads[i];
}
}
Expand Down

0 comments on commit 105f2ab

Please sign in to comment.