Skip to content

Commit 087129d

Browse files
Copilotmathiasrw
andcommitted
Restructure: split code into benchmark-a and benchmark-b, add NEXT as submodule
Co-authored-by: mathiasrw <[email protected]>
1 parent 7488c34 commit 087129d

File tree

16 files changed

+1474
-1111
lines changed

16 files changed

+1474
-1111
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ lerna-debug.log*
88
bun.lockb
99
package-lock.json
1010

11-
.alasql-next/
11+
# AlaSQL NEXT build artifacts
12+
alasql-next/node_modules/
13+
alasql-next/dist/
1214

1315
# Diagnostic reports (https://nodejs.org/api/report.html)
1416
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "alasql-next"]
2+
path = alasql-next
3+
url = https://github.com/AlaSQL/alasql.git
4+
branch = develop

README.md

Lines changed: 61 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,33 @@ Performance benchmarks comparing different npm versions of the [AlaSQL](https://
66

77
This project uses [Bun](https://bun.sh/) to benchmark various AlaSQL versions across a range of SQL operations, from simple queries to complex aggregations. It uses npm aliasing to install multiple versions of AlaSQL simultaneously.
88

9-
## Versions Tested
10-
11-
64 versions across all major releases (sorted by semver):
12-
13-
### 0.x Series
14-
15-
- `0.3.10`, `0.4.12`, `0.5.10`, `0.6.7`, `0.7.1`
16-
17-
### 1.x Series
18-
19-
- `1.7.4`, `1.7.5`
20-
21-
### 2.x Series
9+
## Project Structure
2210

23-
- `2.1.4`, `2.1.6`, `2.1.7`, `2.1.8`, `2.2.1`, `2.2.5`, `2.3.0`, `2.5.0`, `2.5.1`, `2.5.3`, `2.5.4`
24-
25-
### 3.x Series
11+
```
12+
├── alasql-next/ # Git submodule - latest AlaSQL from develop branch
13+
├── performance/
14+
│ ├── benchmark-a/ # Custom benchmark with detailed output
15+
│ │ ├── benchmark.js # Main entry point
16+
│ │ ├── versions.js # AlaSQL version imports
17+
│ │ ├── test-cases.js # SQL test cases
18+
│ │ ├── runner.js # Benchmark execution logic
19+
│ │ ├── data-generators.js # Test data generation
20+
│ │ └── formatters.js # Output formatting
21+
│ └── benchmark-b/ # Bun native benchmark
22+
│ ├── benchmark.js # Uses Bun's bench/group/run
23+
│ ├── versions.js # AlaSQL version imports
24+
│ └── data-generators.js # Test data generation
25+
├── build-next.sh # Script to build NEXT version from submodule
26+
└── package.json
27+
```
2628

27-
- `3.0.0`, `3.1.0`, `3.1.1`
29+
## Versions Tested
2830

29-
### 4.x Series
31+
64 npm versions across all major releases, plus the NEXT version (latest from develop branch):
3032

31-
- `4.0.0`, `4.0.2`, `4.0.4`, `4.0.5`, `4.0.6`
32-
- `4.1.0`, `4.1.1`, `4.1.2`, `4.1.3`, `4.1.4`, `4.1.5`, `4.1.7`, `4.1.8`, `4.1.9`, `4.1.10`, `4.1.11`
33-
- `4.2.1`, `4.2.2`, `4.2.3`, `4.2.4`, `4.2.5`, `4.2.6`, `4.2.7`
34-
- `4.3.0`, `4.3.1`, `4.3.2`, `4.3.3`
35-
- `4.4.0`
36-
- `4.5.0`, `4.5.1`, `4.5.2`
37-
- `4.6.0`, `4.6.1`, `4.6.2`, `4.6.3`, `4.6.4`, `4.6.5`, `4.6.6`
38-
- `4.7.0`, `4.8.0`, `4.9.0`
39-
- `4.10.0`, `4.10.1`
33+
### 0.x - 4.x Series
34+
- `0.3.10` through `4.10.1` (64 versions total)
35+
- `NEXT` - Latest code from the AlaSQL develop branch
4036

4137
## Test Cases
4238

@@ -49,96 +45,89 @@ This project uses [Bun](https://bun.sh/) to benchmark various AlaSQL versions ac
4945

5046
## Prerequisites
5147

52-
- [Bun](https://bun.sh/) runtime (recommended) or Node.js 18+
53-
- npm or bun package manager
48+
- [Bun](https://bun.sh/) runtime
49+
- Git (for submodule management)
50+
- npm or yarn
5451

5552
## Installation
5653

5754
```bash
55+
# Clone with submodules
56+
git clone --recurse-submodules <repo-url>
57+
cd historical-performance
58+
5859
# Install dependencies
59-
npm install
60-
# or
6160
bun install
61+
# or
62+
yarn install
6263
```
6364

6465
## Usage
6566

66-
### Run Full Benchmark
67+
### Benchmark A - Custom Implementation
68+
69+
Custom benchmark with detailed console output, summary tables, and markdown results.
6770

6871
```bash
69-
bun run benchmark
72+
yarn bench-a
7073
```
7174

72-
### Run with Custom Cycles
73-
75+
With custom cycles:
7476
```bash
75-
bun run benchmark.ts --cycles 10 # Run 10 cycles per test
76-
bun run benchmark.ts --cycles 100 # Run 100 cycles per test
77+
yarn bench-a --cycles 10
7778
```
7879

79-
### Run Directly with Bun
80+
### Benchmark B - Bun Native
81+
82+
Uses Bun's native `bench`, `group`, and `run` functions for performance measurement.
8083

8184
```bash
82-
bun run benchmark.ts
83-
bun run benchmark.ts --cycles 25
85+
yarn bench-b
8486
```
8587

86-
The benchmark automatically includes the AlaSQL NEXT version by cloning and building the latest code from the [AlaSQL GitHub repository](https://github.com/AlaSQL/alasql).
87-
8888
## How It Works
8989

90+
### Version Management
91+
9092
The project uses npm aliasing to install multiple AlaSQL versions:
9193

9294
```json
9395
{
9496
"devDependencies": {
9597
"alasql-0.3.10": "npm:[email protected]",
96-
"alasql-0.4.12": "npm:[email protected]",
9798
"alasql-4.10.1": "npm:[email protected]"
98-
// ... 64 versions total
9999
}
100100
}
101101
```
102102

103-
Each version can then be imported separately:
103+
### NEXT Version
104104

105-
```typescript
106-
import alasql0310 from "alasql-0.3.10";
107-
import alasql0412 from "alasql-0.4.12";
108-
import alasql4101 from "alasql-4.10.1";
109-
// ... etc
110-
```
105+
The NEXT version is managed as a git submodule pointing to the AlaSQL develop branch. The `build-next.sh` script handles:
111106

112-
## Sample Output
107+
1. Updating the submodule to latest
108+
2. Installing dependencies
109+
3. Building the distribution
113110

114-
The benchmark produces formatted output showing performance metrics for each version (actual results will vary based on your machine):
111+
## Sample Output (Benchmark A)
115112

116113
```
117114
╔══════════════════════════════════════════════════════════════════════════════╗
118-
║ AlaSQL Historical Performance Benchmark
115+
║ AlaSQL Historical Performance Benchmark (A)
119116
╠══════════════════════════════════════════════════════════════════════════════╣
120117
║ Cycles per test: 50 ║
121-
║ Versions: 0.3.10, 0.4.12, ... 4.10.0, 4.10.1
118+
║ Versions: 0.3.10, 0.4.12, ... 4.10.1, NEXT-abc123
122119
╚══════════════════════════════════════════════════════════════════════════════╝
123120
124-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
125121
📊 Test: Simple SELECT (100 rows)
126-
Basic SELECT * query on a small dataset of 100 rows
127-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
128122
✅ v0.3.10 │ 448.67µs │ 22.29K ops/s
129-
✅ v0.4.12 │ 373.20µs │ 26.80K ops/s
130-
...
131123
✅ v4.10.1 │ 501.28µs │ 19.95K ops/s
132124
🏆 Best: v0.4.12 (26.80K ops/s)
133125
```
134126

135127
### SUMMARY Section
136128

137-
The summary table shows average operations per second as plain integers:
138-
139129
```
140130
📈 SUMMARY - Average Operations per Second by Version
141-
═══════════════════════════════════════════════════════════════════════════════
142131
143132
Rank │ Version │ Avg Ops/s
144133
─────┼───────────┼──────────────
@@ -149,38 +138,33 @@ The summary table shows average operations per second as plain integers:
149138

150139
### DETAILED RESULTS Section
151140

152-
The detailed results are in markdown table format with versions as rows and tests as columns:
153-
154141
```
155142
| | Simple SELECT (100 rows) | WHERE Filtering (1000 rows) | ... | Total |
156143
| --- | --- | --- | --- | --- |
157144
| v0.3.10 ops/s | 22290 | 2510 | ... | 45678 |
158-
| v0.4.12 ops/s | 26800 | 2400 | ... | 48123 |
145+
| vNEXT-abc123 ops/s | 26800 | 2400 | ... | 48123 |
159146
```
160147

161148
## Adding New Versions
162149

163-
To add a new AlaSQL version to benchmark:
164-
165-
1. Add it to `package.json`:
150+
To add a new AlaSQL version:
166151

152+
1. Add to `package.json`:
167153
```json
168154
"alasql-X.Y.Z": "npm:[email protected]"
169155
```
170156

171-
2. Import it in `benchmark.ts`:
172-
173-
```typescript
157+
2. Import in both `performance/benchmark-a/versions.js` and `performance/benchmark-b/versions.js`:
158+
```javascript
174159
import alasqlXYZ from "alasql-X.Y.Z";
175160
```
176161

177-
3. Add it to the `versions` array:
178-
179-
```typescript
180-
{ name: 'alasql-X.Y.Z', version: 'X.Y.Z', alasql: alasqlXYZ as AlaSQLInstance },
162+
3. Add to the `versions` array in both files:
163+
```javascript
164+
{ name: "alasql-X.Y.Z", version: "X.Y.Z", alasql: alasqlXYZ },
181165
```
182166

183-
4. Run `npm install` or `bun install` and then run the benchmark.
167+
4. Run `bun install` or `yarn install`
184168

185169
## License
186170

alasql-next

Submodule alasql-next added at a5f3e9b

0 commit comments

Comments
 (0)