Skip to content

Commit 2cf5b80

Browse files
committed
chore: remove irrelevant async benches
1 parent 008953e commit 2cf5b80

File tree

6 files changed

+4
-92
lines changed

6 files changed

+4
-92
lines changed
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { WithCodSpeedSuite } from "@codspeed/benchmark.js-plugin";
2-
import { aBaz, baz } from "../../src/foobarbaz";
2+
import { baz } from "../../src/foobarbaz";
33

44
export function registerFoobarbazBenchmarks(suite: WithCodSpeedSuite) {
55
suite
@@ -9,12 +9,4 @@ export function registerFoobarbazBenchmarks(suite: WithCodSpeedSuite) {
99
.add("test sync baz 100", () => {
1010
baz(100);
1111
});
12-
13-
suite
14-
.add("test async baz 10", async () => {
15-
await aBaz(10);
16-
})
17-
.add("test async baz 100", async () => {
18-
await aBaz(100);
19-
});
2012
}
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Bench } from "tinybench";
2-
import { aBaz, baz } from "../../src/foobarbaz";
2+
import { baz } from "../../src/foobarbaz";
33

44
export function registerFoobarbazBenchmarks(bench: Bench) {
55
bench
@@ -9,12 +9,4 @@ export function registerFoobarbazBenchmarks(bench: Bench) {
99
.add("test sync baz 100", () => {
1010
baz(100);
1111
});
12-
13-
bench
14-
.add("test async baz 10", async () => {
15-
await aBaz(10);
16-
})
17-
.add("test async baz 100", async () => {
18-
await aBaz(100);
19-
});
2012
}

examples/with-typescript-cjs/src/foobarbaz.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,3 @@ function bar(n: number) {
1414
export function baz(n: number) {
1515
bar(n);
1616
}
17-
18-
// Async version
19-
function dummyThingToAwait() {
20-
return new Promise<void>((resolve) => {
21-
process.nextTick(() => {
22-
resolve();
23-
});
24-
});
25-
}
26-
27-
async function aFoo(n: number) {
28-
await dummyThingToAwait();
29-
let result = 0;
30-
for (let i = 0; i < n; i++) {
31-
result += 1;
32-
}
33-
return result;
34-
}
35-
36-
async function aBar(n: number) {
37-
await dummyThingToAwait();
38-
await aFoo(n);
39-
}
40-
41-
export async function aBaz(n: number) {
42-
await dummyThingToAwait();
43-
await aBar(n);
44-
}
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { WithCodSpeedSuite } from "@codspeed/benchmark.js-plugin";
2-
import { aBaz, baz } from "../../src/foobarbaz";
2+
import { baz } from "../../src/foobarbaz";
33

44
export function registerFoobarbazBenchmarks(suite: WithCodSpeedSuite) {
55
suite
@@ -9,12 +9,4 @@ export function registerFoobarbazBenchmarks(suite: WithCodSpeedSuite) {
99
.add("test sync baz 100", () => {
1010
baz(100);
1111
});
12-
13-
suite
14-
.add("test async baz 10", async () => {
15-
await aBaz(10);
16-
})
17-
.add("test async baz 100", async () => {
18-
await aBaz(100);
19-
});
2012
}
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Bench } from "tinybench";
2-
import { aBaz, baz } from "../../src/foobarbaz";
2+
import { baz } from "../../src/foobarbaz";
33

44
export function registerFoobarbazBenchmarks(bench: Bench) {
55
bench
@@ -9,12 +9,4 @@ export function registerFoobarbazBenchmarks(bench: Bench) {
99
.add("test sync baz 100", () => {
1010
baz(100);
1111
});
12-
13-
bench
14-
.add("test async baz 10", async () => {
15-
await aBaz(10);
16-
})
17-
.add("test async baz 100", async () => {
18-
await aBaz(100);
19-
});
2012
}

examples/with-typescript-esm/src/foobarbaz.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,3 @@ function bar(n: number) {
1414
export function baz(n: number) {
1515
bar(n);
1616
}
17-
18-
// Async version
19-
function dummyThingToAwait() {
20-
return new Promise<void>((resolve) => {
21-
process.nextTick(() => {
22-
resolve();
23-
});
24-
});
25-
}
26-
27-
async function aFoo(n: number) {
28-
await dummyThingToAwait();
29-
let result = 0;
30-
for (let i = 0; i < n; i++) {
31-
result += 1;
32-
}
33-
return result;
34-
}
35-
36-
async function aBar(n: number) {
37-
await dummyThingToAwait();
38-
await aFoo(n);
39-
}
40-
41-
export async function aBaz(n: number) {
42-
await dummyThingToAwait();
43-
await aBar(n);
44-
}

0 commit comments

Comments
 (0)