Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SyMind committed Dec 18, 2024
1 parent 75dbfb1 commit f7394ed
Show file tree
Hide file tree
Showing 9 changed files with 601 additions and 64 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -375,19 +375,11 @@ jobs:
- name: Build Benchmark
run: cargo codspeed build -p rspack_benchmark --features codspeed

- name: Run Rust benchmark
- name: Run benchmark
uses: CodSpeedHQ/action@v3
timeout-minutes: 30
with:
run: cargo codspeed run
token: ${{ secrets.CODSPEED_TOKEN }}

- name: Run JavaScript benchmark
uses: CodSpeedHQ/action@v3
timeout-minutes: 30
with:
working-directory: "packages/bench"
run: pnpm run bench
run: pnpm run bench:ci
token: ${{ secrets.CODSPEED_TOKEN }}

run_benchmark:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"test:webpack": "pnpm --filter \"webpack-test\" test:metric",
"doc-coverage": "pnpm --filter \"@rspack/core\" doc-coverage",
"api-extractor:local": "pnpm --filter \"@rspack/*\" api-extractor --local",
"api-extractor:ci": "pnpm --filter \"@rspack/*\" api-extractor:ci"
"api-extractor:ci": "pnpm --filter \"@rspack/*\" api-extractor:ci",
"bench:ci": "cargo codspeed run && pnpm --filter bench run bench"
},
"homepage": "https://rspack.dev",
"bugs": "https://github.com/web-infra-dev/rspack/issues",
Expand Down
1 change: 1 addition & 0 deletions packages/bench/fixtures/single/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("hello, world!");
22 changes: 0 additions & 22 deletions packages/bench/index.js

This file was deleted.

8 changes: 4 additions & 4 deletions packages/bench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"license": "MIT",
"type": "module",
"scripts": {
"bench": "node index.js"
"bench": "vitest bench --run"
},
"devDependencies": {
"@codspeed/tinybench-plugin": "^4.0.0",
"@rspack/cli": "workspace:*",
"@codspeed/vitest-plugin": "^4.0.0",
"@rspack/core": "workspace:*",
"tinybench": "^3.0.7"
"vitest": "^2.1.8",
"zx": "7.2.3"
}
}
1 change: 1 addition & 0 deletions packages/bench/rspack-ecosystem-benchmark
Submodule rspack-ecosystem-benchmark added at ffd519
28 changes: 28 additions & 0 deletions packages/bench/single.bench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { join } from "node:path";
import { bench, describe } from "vitest";
import { rspack } from "@rspack/core";

describe("single module project", () => {
bench(
"build in production mode",
() =>
new Promise((resolve, reject) => {
rspack(
{
context: join(__dirname, "fixtures/single"),
entry: "index.js",
mode: "production"
},
(err, stats) => {
if (err) {
reject(err);
}
if (stats?.hasErrors()) {
reject(new Error(stats.toString({})));
}
resolve();
}
);
})
);
});
9 changes: 9 additions & 0 deletions packages/bench/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import codspeedPlugin from "@codspeed/vitest-plugin";
import { defineConfig } from "vitest/config";

export default defineConfig({
plugins: [codspeedPlugin()],
test: {
fileParallelism: true
}
});
Loading

0 comments on commit f7394ed

Please sign in to comment.