Skip to content

Commit 700fdfe

Browse files
fix: refactor benchmark directory structure
1 parent ab04fd7 commit 700fdfe

32 files changed

Lines changed: 135 additions & 45723 deletions

.github/workflows/benchmark.yml

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
benchmark-mysql-reads:
2020
name: MySQL Reads Benchmark
2121
runs-on: ubuntu-latest
22+
defaults:
23+
run:
24+
working-directory: ./benchmark
2225

2326
steps:
2427
- uses: actions/checkout@v4
@@ -39,18 +42,21 @@ jobs:
3942
services: mysqldb
4043

4144
- name: Run Benchmark
42-
run: ./benchmark/scripts/run_single_benchmark.sh mysql reads
45+
run: ./scripts/run_single_benchmark.sh mysql reads
4346

4447
- name: Upload Results
4548
uses: actions/upload-artifact@v4
4649
if: success()
4750
with:
4851
name: mysql-reads-results
49-
path: benchmark/BenchmarkDotNet.Artifacts/mysql/reads
52+
path: BenchmarkDotNet.Artifacts/mysql/reads
5053

5154
benchmark-mysql-writes:
5255
name: MySQL Writes Benchmark
5356
runs-on: ubuntu-latest
57+
defaults:
58+
run:
59+
working-directory: ./benchmark
5460

5561
steps:
5662
- uses: actions/checkout@v4
@@ -71,18 +77,21 @@ jobs:
7177
services: mysqldb
7278

7379
- name: Run Benchmark
74-
run: ./benchmark/scripts/run_single_benchmark.sh mysql writes
80+
run: ./scripts/run_single_benchmark.sh mysql writes
7581

7682
- name: Upload Results
7783
uses: actions/upload-artifact@v4
7884
if: success()
7985
with:
8086
name: mysql-writes-results
81-
path: benchmark/BenchmarkDotNet.Artifacts/mysql/writes
87+
path: BenchmarkDotNet.Artifacts/mysql/writes
8288

8389
benchmark-postgresql-reads:
8490
name: PostgreSQL Reads Benchmark
8591
runs-on: ubuntu-latest
92+
defaults:
93+
run:
94+
working-directory: ./benchmark
8695

8796
steps:
8897
- uses: actions/checkout@v4
@@ -103,18 +112,21 @@ jobs:
103112
services: postgresdb
104113

105114
- name: Run Benchmark
106-
run: ./benchmark/scripts/run_single_benchmark.sh postgresql reads
115+
run: ./scripts/run_single_benchmark.sh postgresql reads
107116

108117
- name: Upload Results
109118
uses: actions/upload-artifact@v4
110119
if: success()
111120
with:
112121
name: postgresql-reads-results
113-
path: benchmark/BenchmarkDotNet.Artifacts/postgresql/reads
122+
path: BenchmarkDotNet.Artifacts/postgresql/reads
114123

115124
benchmark-postgresql-writes:
116125
name: PostgreSQL Writes Benchmark
117126
runs-on: ubuntu-latest
127+
defaults:
128+
run:
129+
working-directory: ./benchmark
118130

119131
steps:
120132
- uses: actions/checkout@v4
@@ -135,18 +147,21 @@ jobs:
135147
services: postgresdb
136148

137149
- name: Run Benchmark
138-
run: ./benchmark/scripts/run_single_benchmark.sh postgresql writes
150+
run: ./scripts/run_single_benchmark.sh postgresql writes
139151

140152
- name: Upload Results
141153
uses: actions/upload-artifact@v4
142154
if: success()
143155
with:
144156
name: postgresql-writes-results
145-
path: benchmark/BenchmarkDotNet.Artifacts/postgresql/writes
157+
path: BenchmarkDotNet.Artifacts/postgresql/writes
146158

147159
benchmark-sqlite-reads:
148160
name: SQLite Reads Benchmark
149161
runs-on: ubuntu-latest
162+
defaults:
163+
run:
164+
working-directory: ./benchmark
150165

151166
steps:
152167
- uses: actions/checkout@v4
@@ -162,18 +177,21 @@ jobs:
162177
load-mode: strict
163178

164179
- name: Run Benchmark
165-
run: ./benchmark/scripts/run_single_benchmark.sh sqlite reads
180+
run: ./scripts/run_single_benchmark.sh sqlite reads
166181

167182
- name: Upload Results
168183
uses: actions/upload-artifact@v4
169184
if: success()
170185
with:
171186
name: sqlite-reads-results
172-
path: benchmark/BenchmarkDotNet.Artifacts/sqlite/reads
187+
path: BenchmarkDotNet.Artifacts/sqlite/reads
173188

174189
benchmark-sqlite-writes:
175190
name: SQLite Writes Benchmark
176191
runs-on: ubuntu-latest
192+
defaults:
193+
run:
194+
working-directory: ./benchmark
177195

178196
steps:
179197
- uses: actions/checkout@v4
@@ -189,19 +207,22 @@ jobs:
189207
load-mode: strict
190208

191209
- name: Run Benchmark
192-
run: ./benchmark/scripts/run_single_benchmark.sh sqlite writes
210+
run: ./scripts/run_single_benchmark.sh sqlite writes
193211

194212
- name: Upload Results
195213
uses: actions/upload-artifact@v4
196214
if: success()
197215
with:
198216
name: sqlite-writes-results
199-
path: benchmark/BenchmarkDotNet.Artifacts/sqlite/writes
217+
path: BenchmarkDotNet.Artifacts/sqlite/writes
200218

201219
push-results:
202220
name: Push Results
203221
runs-on: ubuntu-latest
204-
if: always()
222+
defaults:
223+
run:
224+
working-directory: ./benchmark
225+
if: always() && github.event_name == 'release'
205226
needs: [
206227
benchmark-mysql-reads, benchmark-mysql-writes,
207228
benchmark-postgresql-reads, benchmark-postgresql-writes,
@@ -215,37 +236,40 @@ jobs:
215236
uses: actions/download-artifact@v4
216237
with:
217238
name: mysql-reads-results
218-
path: benchmark/BenchmarkDotNet.Artifacts/mysql/reads
239+
path: BenchmarkDotNet.Artifacts/mysql/reads
219240

220241
- name: Download MySQL Writes Results
221242
uses: actions/download-artifact@v4
222243
with:
223244
name: mysql-writes-results
224-
path: benchmark/BenchmarkDotNet.Artifacts/mysql/writes
245+
path: BenchmarkDotNet.Artifacts/mysql/writes
225246

226247
- name: Download PostgreSQL Reads Results
227248
uses: actions/download-artifact@v4
228249
with:
229250
name: postgresql-reads-results
230-
path: benchmark/BenchmarkDotNet.Artifacts/postgresql/reads
251+
path: BenchmarkDotNet.Artifacts/postgresql/reads
231252

232253
- name: Download PostgreSQL Writes Results
233254
uses: actions/download-artifact@v4
234255
with:
235256
name: postgresql-writes-results
236-
path: benchmark/BenchmarkDotNet.Artifacts/postgresql/writes
257+
path: BenchmarkDotNet.Artifacts/postgresql/writes
237258

238259
- name: Download SQLite Reads Results
239260
uses: actions/download-artifact@v4
240261
with:
241262
name: sqlite-reads-results
242-
path: benchmark/BenchmarkDotNet.Artifacts/sqlite/reads
263+
path: BenchmarkDotNet.Artifacts/sqlite/reads
243264

244265
- name: Download SQLite Writes Results
245266
uses: actions/download-artifact@v4
246267
with:
247268
name: sqlite-writes-results
248-
path: benchmark/BenchmarkDotNet.Artifacts/sqlite/writes
269+
path: BenchmarkDotNet.Artifacts/sqlite/writes
270+
271+
- name: Update Wasm Plugin
272+
run: ./scripts/update_wasm_plugin.sh
249273

250274
- name: Create Pull Request
251275
uses: peter-evans/create-pull-request@v6

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,7 @@ docker-upload/*
139139

140140
plugin.wasm
141141
*.db
142-
.env.bak
142+
.env.bak
143+
**/.env.bak
144+
145+
**/*.wasm

Makefile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,25 @@ run-end2end-tests:
5050
./end2end/scripts/run_tests.sh
5151

5252
# Benchmarks
53-
run-benchmark-sqlite-reads: sqlc-generate
53+
sqlc-generate-benchmark:
54+
SQLCCACHE=./; sqlc -f benchmark/sqlc.yaml generate
55+
56+
run-benchmark-sqlite-reads: sqlc-generate-benchmark
5457
./benchmark/scripts/run_single_benchmark.sh sqlite reads
5558

56-
run-benchmark-sqlite-writes: sqlc-generate
59+
run-benchmark-sqlite-writes: sqlc-generate-benchmark
5760
./benchmark/scripts/run_single_benchmark.sh sqlite writes
5861

59-
run-benchmark-postgresql-reads: sqlc-generate
62+
run-benchmark-postgresql-reads: sqlc-generate-benchmark
6063
./benchmark/scripts/run_single_benchmark.sh postgresql reads
6164

62-
run-benchmark-postgresql-writes: sqlc-generate
65+
run-benchmark-postgresql-writes: sqlc-generate-benchmark
6366
./benchmark/scripts/run_single_benchmark.sh postgresql writes
6467

65-
run-benchmark-mysql-reads: sqlc-generate
68+
run-benchmark-mysql-reads: sqlc-generate-benchmark
6669
./benchmark/scripts/run_single_benchmark.sh mysql reads
6770

68-
run-benchmark-mysql-writes: sqlc-generate
71+
run-benchmark-mysql-writes: sqlc-generate-benchmark
6972
./benchmark/scripts/run_single_benchmark.sh mysql writes
7073

7174
# Manual

benchmark/.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SQLITE_CONNECTION_STRING="Data Source=benchmark.db;Mode=ReadWrite"
2+
MYSQL_CONNECTION_STRING="server=localhost;database=sales;user=root;AllowLoadLocalInfile=true;ConvertZeroDateTime=True"
3+
POSTGRES_CONNECTION_STRING="host=localhost;database=tests;username=postgres;password=pass;IncludeErrorDetail=true"
4+
5+
POSTGRES_USER="postgres"
6+
POSTGRES_PASSWORD="pass"
7+
TESTS_DB="tests"

benchmark/BenchmarkRunner/BenchmarkRunner.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</ItemGroup>
3333

3434
<ItemGroup>
35-
<Content Include="..\..\examples\config\sqlite\benchmark\schema.sql" TargetPath="sqlite.schema.sql">
35+
<Content Include="..\config\sqlite\schema.sql" TargetPath="sqlite.schema.sql">
3636
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3737
</Content>
3838
<Content Include="..\..\.env">

benchmark/MysqlSqlcImpl/MysqlSqlcImpl.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--// auto-generated by sqlc - do not edit-->
22
<!--Run the following to add the project to the solution:
3-
dotnet sln add benchmark/MysqlSqlcImpl/MysqlSqlcImpl.csproj
3+
dotnet sln add MysqlSqlcImpl/MysqlSqlcImpl.csproj
44
-->
55
<Project Sdk="Microsoft.NET.Sdk">
66

0 commit comments

Comments
 (0)