Skip to content

Commit

Permalink
Add benchmark documentation and improve publish script
Browse files Browse the repository at this point in the history
Created a README for benchmark tests, outlining setup, scenarios, and results. Enhanced the publish script to include documentation generation, version tagging, and cleanup adjustments. Renamed benchmark folders for better clarity.
  • Loading branch information
smyrgeorge committed Jan 15, 2025
1 parent ad622f7 commit c7f1b2c
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
31 changes: 31 additions & 0 deletions bench/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# sqlx4k - Benchmarks

## Setup

- All tests were performed on my MacBook Pro M1 Max, 64GB RAM.
- The database was installed inside a Docker container, using ARM64 images.
- Apart from the database drivers, the rest of the code was kept as similar as possible.
- The Docker engine was using the new Docker VMM.

## Runs

We conducted three scenarios:

- `no-transaction`: A set of 3 queries was executed — two inserts and one fetch.
- `transaction-commit`: 3 queries were executed within a transaction (two inserts and one fetch), followed by a
fetch after the transaction was completed.
- `transaction-rollback`: 3 queries were executed within a transaction (two inserts and one fetch), followed by a
fetch after the transaction was rolled back.

In each scenario, we used **4 workers**. Each worker executed the test **1000 times** in a loop.
We performed **10 runs** per scenario and calculated the average execution time.

## Results

### PostgreSQL

| kind | no-tx | tx-commit | tx-rollback |
|-------------------|:---------:|:---------:|:-----------:|
| rust-sqlx | | | |
| spring-boot-r2dbc | 2.982300s | 4.623800s | 3.522100s |
| sqlx4k | 3.484700s | 4.884900s | 3.552010s |
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 15 additions & 1 deletion scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#!/usr/bin/env sh

./gradlew clean build -Ptargets=all

./gradlew :dokkaHtmlMultiModule
rm -rf ./docs/*
cp -R ./build/dokka/htmlMultiModule/* ./docs/

version=$(./gradlew properties -q | awk '/^version:/ {print $2}')
git add --all
git commit -m "Added documentation for '$version'."
git push

git tag "$version" -f
git push --tags -f

cat local.properties >> gradle.properties
./gradlew clean publishAllPublicationsToMavenCentralRepository -Ptargets=all
./gradlew publishAllPublicationsToMavenCentralRepository -Ptargets=all
git checkout .

0 comments on commit c7f1b2c

Please sign in to comment.