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 9b97ae9
Show file tree
Hide file tree
Showing 7 changed files with 581 additions and 63 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
14 changes: 14 additions & 0 deletions packages/bench/arco-pro.bench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { bench, describe } from "vitest";

function fibonacci(n: number): number {
if (n < 2) {
return n;
}
return fibonacci(n - 1) + fibonacci(n - 2);
}

describe("arco pro", () => {
bench("build with development mode", () => {
fibonacci(10);
});
});
22 changes: 0 additions & 22 deletions packages/bench/index.js

This file was deleted.

6 changes: 3 additions & 3 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",
"@codspeed/vitest-plugin": "^4.0.0",
"@rspack/cli": "workspace:*",
"@rspack/core": "workspace:*",
"tinybench": "^3.0.7"
"vitest": "^2.1.8"
}
}
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 9b97ae9

Please sign in to comment.