Skip to content

Commit a994335

Browse files
vkuttypCopilot
andcommitted
docs: add benchmark results to README
- cosmo-benchmark/README.md: add Latest Results section with actual numbers from latest run (20 iter, 46-row table, Apple Silicon) - README.md: add Benchmarks section with head-to-head comparison table linking to cosmo-benchmark/ CosmoSQL (NIO) is 1.7× faster than FreeTDS on warm queries. decode<T>() and toJson() are NIO-only features at ~1.5 ms. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent db754f0 commit a994335

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,23 @@ swift test
10781078

10791079
---
10801080

1081+
## Benchmarks
1082+
1083+
> CosmoSQLClient (NIO) vs SQLClient-Swift (FreeTDS) · macOS · Apple Silicon · MSSQL Server 2019
1084+
> Table: 46 rows × 20 columns · 20 iterations per scenario
1085+
1086+
| Scenario | CosmoSQL (NIO) | FreeTDS | Winner |
1087+
|---|---|---|---|
1088+
| Cold connect + query + close | 14.30 ms | 13.92 ms | ≈ tie |
1089+
| Warm full-table query | **0.95 ms** | 1.58 ms | 🔵 **1.7× faster** |
1090+
| Warm single-row query | **0.64 ms** | 1.10 ms | 🔵 **1.7× faster** |
1091+
| Warm `decode<T>()` (Codable) | 1.53 ms | N/A | 🔵 only |
1092+
| Warm `toJson()` | 1.56 ms | N/A | 🔵 only |
1093+
1094+
Run the benchmarks yourself — see [`cosmo-benchmark/`](cosmo-benchmark/).
1095+
1096+
---
1097+
10811098
## Related Projects
10821099

10831100
- [SQLClient-Swift](https://github.com/vkuttyp/SQLClient-Swift) — The original MSSQL driver using FreeTDS (predecessor to this package)

cosmo-benchmark/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,34 @@ BENCH_USER=sa BENCH_PASS=mypass BENCH_ITER=50 \
2828
swift run -c release
2929
```
3030

31+
## Latest Results
32+
33+
> Environment: macOS, Apple Silicon, frpc tunnel → MSSQL Server 2019
34+
> Table: `Accounts` (46 rows × 20 columns) · 20 iterations per scenario
35+
36+
```
37+
🔵 CosmoSQLClient (NIO-based, pure Swift)
38+
Cold connect + query + close avg 14.30 ms min 10.84 ms max 44.55 ms
39+
Warm query only (persistent conn) avg 0.95 ms min 0.74 ms max 1.23 ms
40+
Warm single-row query avg 0.64 ms min 0.47 ms max 1.80 ms
41+
Warm query + decode<Account>() avg 1.53 ms min 1.25 ms max 2.36 ms
42+
Warm query + toJson() avg 1.56 ms min 1.33 ms max 2.83 ms
43+
44+
🟠 SQLClient-Swift (FreeTDS-based)
45+
Cold connect + query + disconnect avg 13.92 ms min 11.06 ms max 20.54 ms
46+
Warm query only (persistent conn) avg 1.58 ms min 1.17 ms max 4.03 ms
47+
Warm single-row query avg 1.10 ms min 0.91 ms max 2.41 ms
48+
```
49+
50+
### Head-to-head (warm queries)
51+
52+
| Scenario | CosmoSQL (NIO) | FreeTDS | Winner |
53+
|---|---|---|---|
54+
| Warm full-table query | **0.95 ms** | 1.58 ms | 🔵 **1.7× faster** |
55+
| Warm single-row query | **0.64 ms** | 1.10 ms | 🔵 **1.7× faster** |
56+
| `decode<T>()` (Codable) | 1.53 ms | N/A | 🔵 only |
57+
| `toJson()` | 1.56 ms | N/A | 🔵 only |
58+
3159
## Scenarios
3260

3361
| Scenario | CosmoSQL (NIO) | FreeTDS |

0 commit comments

Comments
 (0)