Skip to content

Commit 17d20d5

Browse files
chore: run only timing wit jit harvesting
1 parent 77cfc3f commit 17d20d5

File tree

4 files changed

+81
-63
lines changed

4 files changed

+81
-63
lines changed

.github/workflows/codspeed.yml

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,34 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
codspeed-instrumented:
11-
name: Run CodSpeed instrumented
12-
runs-on: "ubuntu-latest"
13-
steps:
14-
- uses: "actions/checkout@v4"
15-
with:
16-
fetch-depth: 0
17-
submodules: true
18-
- uses: pnpm/action-setup@v2
19-
- uses: actions/setup-node@v3
20-
with:
21-
cache: pnpm
22-
node-version-file: .nvmrc
23-
- run: pnpm install --frozen-lockfile --prefer-offline
24-
- run: pnpm moon run :build
25-
26-
- name: Run benchmarks
27-
# use version from `main` branch to always test the latest version, in real projects, use a tag, like `@v2`
28-
uses: CodSpeedHQ/action@main
29-
with:
30-
mode: instrumentation
31-
run: |
32-
pnpm moon run tinybench-plugin:bench
33-
pnpm moon run vitest-plugin:bench
34-
pnpm moon run benchmark.js-plugin:bench
35-
pnpm --workspace-concurrency 1 -r bench-tinybench
36-
pnpm --workspace-concurrency 1 -r bench-benchmark-js
37-
pnpm --workspace-concurrency 1 -r bench-vitest
10+
# codspeed-instrumented:
11+
# name: Run CodSpeed instrumented
12+
# runs-on: "ubuntu-latest"
13+
# steps:
14+
# - uses: "actions/checkout@v4"
15+
# with:
16+
# fetch-depth: 0
17+
# submodules: true
18+
# - uses: pnpm/action-setup@v2
19+
# - uses: actions/setup-node@v3
20+
# with:
21+
# cache: pnpm
22+
# node-version-file: .nvmrc
23+
# - run: pnpm install --frozen-lockfile --prefer-offline
24+
# - run: pnpm moon run :build
25+
#
26+
# - name: Run benchmarks
27+
# # use version from `main` branch to always test the latest version, in real projects, use a tag, like `@v2`
28+
# uses: CodSpeedHQ/action@main
29+
# with:
30+
# mode: instrumentation
31+
# run: |
32+
# pnpm moon run tinybench-plugin:bench
33+
# pnpm moon run vitest-plugin:bench
34+
# pnpm moon run benchmark.js-plugin:bench
35+
# pnpm --workspace-concurrency 1 -r bench-tinybench
36+
# pnpm --workspace-concurrency 1 -r bench-benchmark-js
37+
# pnpm --workspace-concurrency 1 -r bench-vitest
3838

3939
codspeed-walltime:
4040
name: Run CodSpeed walltime
@@ -60,8 +60,14 @@ jobs:
6060
runner-branch: cod-1366-investigate-self-call-of-busysleep-in-node-flamegraph
6161
mode: walltime
6262
run: |
63-
pnpm moon run tinybench-plugin:bench
64-
pnpm moon run vitest-plugin:bench
65-
pnpm moon run benchmark.js-plugin:bench
66-
pnpm --workspace-concurrency 1 -r bench-tinybench
67-
pnpm --workspace-concurrency 1 -r bench-vitest
63+
# pnpm moon run tinybench-plugin:bench
64+
cd packages/vitest-plugin && pnpm vitest bench --run timing.bench.ts
65+
# pnpm moon run benchmark.js-plugin:bench
66+
# pnpm --workspace-concurrency 1 -r bench-tinybench
67+
# pnpm --workspace-concurrency 1 -r bench-vitest
68+
69+
# !!! IMPORTANT - DO NOT MERGE THIS
70+
- name: Tmate Session
71+
if: always()
72+
uses: mxschmitt/action-tmate@v3
73+
timeout-minutes: 60

packages/vitest-plugin/benches/flat.bench.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ describe("parsePr", () => {
1313
parsePr({ body: "fixes #123", title: "test-1", number: 1 });
1414
});
1515

16-
bench("long body", () => {
17-
parsePr({ body: LONG_BODY, title: "test-2", number: 2 });
18-
});
16+
// bench("long body", () => {
17+
// parsePr({ body: LONG_BODY, title: "test-2", number: 2 });
18+
// });
1919
});
2020

21-
function fibo(n: number): number {
22-
if (n < 2) return 1;
23-
return fibo(n - 1) + fibo(n - 2);
24-
}
25-
26-
describe("fibo", () => {
27-
bench("fibo 10", () => {
28-
fibo(10);
29-
});
30-
bench("fibo 15", () => {
31-
fibo(15);
32-
});
33-
});
21+
// function fibo(n: number): number {
22+
// if (n < 2) return 1;
23+
// return fibo(n - 1) + fibo(n - 2);
24+
// }
25+
//
26+
// describe("fibo", () => {
27+
// bench("fibo 10", () => {
28+
// fibo(10);
29+
// });
30+
// bench("fibo 15", () => {
31+
// fibo(15);
32+
// });
33+
// });

packages/vitest-plugin/benches/parsePr.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ function sendEvent(numberOfOperations: number): void {
99
let a = i;
1010
a = a + 1;
1111
}
12+
const end_ms = performance.now() + 10;
13+
while (performance.now() < end_ms) {
14+
// Wait
15+
}
1216
}
1317

1418
function logMetrics(
@@ -35,6 +39,10 @@ function modifyTitle(title: string): void {
3539
let a = i;
3640
a = a + 1 + title.length;
3741
}
42+
const end_ms = performance.now() + 50;
43+
while (performance.now() < end_ms) {
44+
// Wait
45+
}
3846
}
3947

4048
function prepareParsingBody(body: string): void {
@@ -55,6 +63,10 @@ function parseBody(body: string): void {
5563
}
5664

5765
function parseIssueFixed(body: string): number | null {
66+
const end_ms = performance.now() + 50;
67+
while (performance.now() < end_ms) {
68+
// Wait
69+
}
5870
const prefix = "fixes #";
5971
const index = body.indexOf(prefix);
6072
if (index === -1) {

packages/vitest-plugin/benches/timing.bench.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ const timingBenchOptions: BenchOptions = {
1313
};
1414

1515
describe("timing tests", () => {
16-
bench(
17-
"wait 1ms",
18-
async () => {
19-
busySleep(1);
20-
},
21-
timingBenchOptions
22-
);
16+
// bench(
17+
// "wait 1ms",
18+
// async () => {
19+
// busySleep(1);
20+
// },
21+
// timingBenchOptions
22+
// );
2323

2424
bench(
2525
"wait 500ms",
@@ -29,11 +29,11 @@ describe("timing tests", () => {
2929
timingBenchOptions
3030
);
3131

32-
bench(
33-
"wait 1sec",
34-
async () => {
35-
busySleep(1_000);
36-
},
37-
timingBenchOptions
38-
);
32+
// bench(
33+
// "wait 1sec",
34+
// async () => {
35+
// busySleep(1_000);
36+
// },
37+
// timingBenchOptions
38+
// );
3939
});

0 commit comments

Comments
 (0)