Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 11 additions & 55 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Benchmark
name: Benchmark PR

on:
pull_request_target:
Expand All @@ -11,17 +11,8 @@ jobs:
permissions:
contents: read
outputs:
PR-BENCH-14: ${{ steps.benchmark-pr.outputs.BENCH_RESULT14 }}
PR-BENCH-16: ${{ steps.benchmark-pr.outputs.BENCH_RESULT16 }}
PR-BENCH-18: ${{ steps.benchmark-pr.outputs.BENCH_RESULT18 }}
PR-BENCH-20: ${{ steps.benchmark-pr.outputs.BENCH_RESULT20 }}
MASTER-BENCH-14: ${{ steps.benchmark-master.outputs.BENCH_RESULT14 }}
MASTER-BENCH-16: ${{ steps.benchmark-master.outputs.BENCH_RESULT16 }}
MASTER-BENCH-18: ${{ steps.benchmark-master.outputs.BENCH_RESULT18 }}
MASTER-BENCH-20: ${{ steps.benchmark-master.outputs.BENCH_RESULT20 }}
strategy:
matrix:
node-version: [14, 16, 18, 20]
PR-BENCH: ${{ steps.benchmark-pr.outputs.BENCH_RESULT }}
MASTER-BENCH: ${{ steps.benchmark-master.outputs.BENCH_RESULT }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -31,7 +22,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version: 18
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set this to lts/* so we don't have to keep bumping it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will anyway open an issue regarding general benchmark wf.


- name: Install
run: |
Expand All @@ -40,12 +31,12 @@ jobs:
- name: Run benchmark
id: benchmark-pr
run: |
npm run --silent benchmark > ./bench-result
npm run --silent bench > ./bench-result
content=$(cat ./bench-result)
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=BENCH_RESULT${{matrix.node-version}}::$content"
echo "::set-output name=BENCH_RESULT::$content"

# master benchmark
- uses: actions/checkout@v3
Expand All @@ -59,14 +50,15 @@ jobs:
- name: Run benchmark
id: benchmark-master
run: |
npm run --silent benchmark > ./bench-result
npm run --silent bench > ./bench-result
content=$(cat ./bench-result)
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=BENCH_RESULT${{matrix.node-version}}::$content"
echo "::set-output name=BENCH_RESULT::$content"

output-benchmark:
if: "always()"
needs: [benchmark]
runs-on: ubuntu-latest
permissions:
Expand All @@ -77,49 +69,13 @@ jobs:
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: |
**Node**: 14
**PR**:
```
${{ needs.benchmark.outputs.PR-BENCH-14 }}
${{ needs.benchmark.outputs.PR-BENCH }}
```
**MASTER**:
```
${{ needs.benchmark.outputs.MASTER-BENCH-14 }}
```

---

**Node**: 16
**PR**:
```
${{ needs.benchmark.outputs.PR-BENCH-16 }}
```
**MASTER**:
```
${{ needs.benchmark.outputs.MASTER-BENCH-16 }}
```

---

**Node**: 18
**PR**:
```
${{ needs.benchmark.outputs.PR-BENCH-18 }}
```
**MASTER**:
```
${{ needs.benchmark.outputs.MASTER-BENCH-18 }}

---

**Node**: 20
**PR**:
```
${{ needs.benchmark.outputs.PR-BENCH-20 }}
```
**MASTER**:
```
${{ needs.benchmark.outputs.MASTER-BENCH-20 }}
${{ needs.benchmark.outputs.MASTER-BENCH }}
```

- uses: actions-ecosystem/action-remove-labels@v1
Expand Down
2 changes: 1 addition & 1 deletion benchmark/bench-thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { workerData: benchmark, parentPort } = require('worker_threads')

const Benchmark = require('benchmark')
Benchmark.options.minSamples = 500
Benchmark.options.minSamples = 100

const suite = Benchmark.Suite()

Expand Down