feat: harden storage, schema persistence, fair benches, fix wire crash
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled

Core storage: hash MemTable, WAL group commit, L0 compaction rebuild,
reader-writer lock, and a global StorageGate so HTTP workers and TCP
share the LSM safely under multi-thread access.

Schema: durable CREATE/ALTER/DROP under _schema:tables:* with full LSM
restore on open. Executor types/values/schema split into query/exec/.

Wire protocol: switch default MM to ARC — ORC cycle collector segfaulted
after ~20 async INSERTs. Fair multi-tier benchmarks (SQLite/HTTP/wire/PG)
and honesty docs for mixed-tier comparisons.
This commit is contained in:
2026-07-18 16:55:50 +03:00
parent aa4ab11210
commit 8db5cfe7e1
31 changed files with 3131 additions and 797 deletions
+20 -29
View File
@@ -1,38 +1,29 @@
# BaraDB vs PostgreSQL — Real Benchmark Results
# Legacy mixed-tier comparison
Generated from actual execution on:
- **CPU:** AMD Ryzen 9 5900X
- **PostgreSQL:** 15.18 (local)
- **BaraDB:** git `42043f3`
This file used to claim large “speedups” of BaraDB over PostgreSQL by comparing:
## Methodology
- **PostgreSQL:** client-server (psycopg2, network, SQL)
- **BaraDB:** in-process LSM (no network, no SQL)
- PostgreSQL: single-row INSERT/SELECT via psycopg2 (client-server overhead included)
- BaraDB: in-process Nim code (no network overhead)
- Same dataset sizes for both systems
That is **not a fair product comparison**.
## Results
## Use the fair suite instead
| Test | PostgreSQL | BaraDB | Speedup |
|------|-----------|--------|---------|
| KV Write (100K) | 16.82K/s (5.946s) | 32.23K/s (3.103s) | 1.9x (BaraDB) |
| KV Read (100K) | 15.08K/s (6.630s) | 3.95M/s (25.3ms) | 261.9x (BaraDB) |
| BTree Insert (100K) | 17.66K/s (5.664s) | 2.52M/s (39.7ms) | 142.8x (BaraDB) |
| BTree Get (100K) | 14.50K/s (6.899s) | 2.34M/s (42.7ms) | 161.4x (BaraDB) |
| BTree Scan (1K ranges) | 2.39K/s (419.2ms) | 11.03M/s (1.0ms) | 4623.3x (BaraDB) |
| FTS Index (10K docs) | 17.98K/s (556.3ms) | 119.99K/s (83.3ms) | 6.7x (BaraDB) |
| FTS Search (1K queries) | 784.12/s (1.275s) | 1.36K/s (734.0ms) | 1.7x (BaraDB) |
```bash
nim c -d:release -r benchmarks/bench_all.nim # embedded BaraDB
python3 benchmarks/fair_bench.py # SQLite + optional PG/HTTP
# report → benchmarks/FAIR_COMPARISON.md
```
## Summary
See:
- **Total PostgreSQL time:** 27.389s
- **Total BaraDB time:** 4.029s
- **Overall speedup:** BaraDB is **6.8x faster**
- [`FAIR_COMPARISON.md`](FAIR_COMPARISON.md) — latest multi-tier results
- [`README.md`](README.md) — methodology and env vars
## Notes
## If you regenerate the legacy report
- PostgreSQL includes network round-trip and SQL parsing overhead per operation.
- BaraDB runs in-process with zero serialization/network cost.
- For embedded/single-node use cases, BaraDB shows significant advantage.
- BaraDB now outperforms PostgreSQL on all tested metrics including FTS search after optimizations.
- PostgreSQL excels at durability, replication, and complex ACID transactions.
```bash
python3 benchmarks/generate_report.py # without --fair
```
It will rewrite this file with an explicit **mixed tiers** warning banner.