Skip to content

Commit 19de73f

Browse files
authored
feat: add comparisson with other benchmark libs (#106)
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
1 parent 315d551 commit 19de73f

4 files changed

Lines changed: 527 additions & 0 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Benchmark Comparison
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
issues: write
11+
contents: read
12+
id-token: write
13+
14+
jobs:
15+
runner-start:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Configure AWS Credentials
19+
uses: aws-actions/configure-aws-credentials@v4
20+
with:
21+
aws-region: us-west-2
22+
role-to-assume: arn:aws:iam::800406105498:role/RafaelGSS-nodejs-bench-operations
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Start Runner
27+
uses: nodesource/aws-eco-runner@v1.0.0-beta.3
28+
with:
29+
instances_id: '["i-065f0f848eb1615ae"]'
30+
action: 'start'
31+
aws_default_region: 'us-west-2'
32+
33+
benchmark:
34+
name: Run Benchmark Comparisons
35+
runs-on: self-hosted
36+
continue-on-error: true
37+
38+
strategy:
39+
matrix:
40+
node-version: [18, 20, 22, 24]
41+
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
46+
- name: Setup Node.js
47+
uses: actions/setup-node@v4
48+
with:
49+
node-version: ${{ matrix.node-version }}
50+
cache: 'npm'
51+
52+
- name: Install dependencies
53+
run: npm install --dev
54+
55+
- name: Run basic comparison
56+
run: node --allow-natives-syntax examples/benchmark-comparison/comparison.js
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Benchmark Comparison Framework
2+
3+
This directory contains a framework for comparing `bench-node` against other popular benchmark libraries:
4+
5+
- [Benchmark.js](https://benchmarkjs.com/)
6+
- [Mitata](https://github.com/evanwashere/mitata)
7+
- [Tinybench](https://github.com/tinylibs/tinybench)
8+
9+
## Test Cases
10+
11+
The comparison focuses on four key test scenarios:
12+
13+
1. **JIT Optimizable** - Simple operations that the JavaScript JIT compiler might optimize away
14+
2. **Regex Test** - Regular expression pattern matching operations
15+
3. **Fibonacci** - CPU-bound recursive calculation
16+
17+
## Running the Comparisons
18+
19+
To run any of the comparison scripts, use:
20+
21+
```bash
22+
node --allow-natives-syntax examples/benchmark-comparison/comparison.js
23+
```
24+
25+
> **Note:** All bench-node scripts must be run with the `--allow-natives-syntax` flag.

0 commit comments

Comments
 (0)