Skip to content

Commit

Permalink
Change performance test threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdalisue committed Jun 13, 2021
1 parent 2dab9ae commit 138fada
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert, assertEquals, io } from "./deps_test.ts";
import { assert, assertEquals, delay, io } from "./deps_test.ts";
import { WorkerReader, WorkerWriter } from "./mod.ts";

async function timeIt(fn: () => Promise<void>): Promise<number> {
Expand Down Expand Up @@ -37,14 +37,15 @@ Deno.test({
await io.writeAll(writer, buffer);
};

await delay(1000);
const [rt, wt] = await Promise.all([
timeIt(consumer),
timeIt(producer),
]);

// Peformance check
const rtThreshold = 3000;
const wtThreshold = 3000;
const rtThreshold = 500;
const wtThreshold = 500;
assert(rt < rtThreshold, "Reader is too slow");
assert(wt < wtThreshold, "Writer is too slow");
} finally {
Expand Down Expand Up @@ -82,14 +83,15 @@ Deno.test({
await io.writeAll(writer, buffer);
};

await delay(1000);
const [rt, wt] = await Promise.all([
timeIt(consumer),
timeIt(producer),
]);

// Peformance check
const rtThreshold = 5000;
const wtThreshold = 5000;
const rtThreshold = 500;
const wtThreshold = 500;
assert(rt < rtThreshold, "Reader is too slow");
assert(wt < wtThreshold, "Writer is too slow");
} finally {
Expand Down Expand Up @@ -127,14 +129,15 @@ Deno.test({
await io.writeAll(writer, buffer);
};

await delay(1000);
const [rt, wt] = await Promise.all([
timeIt(consumer),
timeIt(producer),
]);

// Peformance check
const rtThreshold = 30000;
const wtThreshold = 30000;
const rtThreshold = 500;
const wtThreshold = 500;
assert(rt < rtThreshold, "Reader is too slow");
assert(wt < wtThreshold, "Writer is too slow");
} finally {
Expand Down

0 comments on commit 138fada

Please sign in to comment.