@@ -323,3 +323,103 @@ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for gui
323323
324324If you find SharpCoreDB useful, please consider [ sponsoring the project] ( https://github.com/sponsors/mpcoredeveloper ) !
325325
326+ ---
327+
328+ ## 📊 Reproducible Benchmark Matrix (SQLite vs LiteDB vs SharpCoreDB)
329+
330+ Run the benchmarks yourself:
331+
332+ ``` bash
333+ cd tests/SharpCoreDB.Benchmarks
334+ # Runs StorageEngineComparisonBenchmark with all scenarios
335+ DOTNET_EnableHWIntrinsic=1 dotnet run -c Release --filter StorageEngineComparisonBenchmark
336+ ```
337+
338+ ** Scenarios covered (all pre-populated with the same data set):**
339+ - SQLite (baseline, single-file)
340+ - LiteDB (baseline, single-file)
341+ - SharpCoreDB Directory (PageBased) – unencrypted
342+ - SharpCoreDB Directory (PageBased) – AES-256 encrypted
343+ - SharpCoreDB SingleFile (.scdb) – unencrypted
344+ - SharpCoreDB SingleFile (.scdb) – AES-256 encrypted (fixed 32-byte key)
345+
346+ ** Fairness/optimal paths:**
347+ - Page cache enabled (5k pages), WAL buffering on, validation off for benchmark runs
348+ - SingleFile uses ` DatabaseOptions ` with mmap enabled; encryption uses AES-256-GCM
349+ - Same schema and batch sizes as earlier results (Insert 1k, Update 500 random, Select with WHERE, Analytics columnar SIMD)
350+
351+ Use the produced ` BenchmarkDotNet.Artifacts/results/*-report-github.md ` to compare your run with ours.
352+
353+ ---
354+
355+ ## Latest Benchmark Summary (Jan 11, 2026)
356+
357+ Environment: Windows 11, i7-10850H, .NET 10.0.1, BenchmarkDotNet 0.15.8
358+
359+ Settings: IterationCount=5, WarmupCount=2, Toolchain=InProcessEmit
360+
361+ ### Insert (1K rows)
362+ - PageBased: 7.63 ms (baseline, 2.01 MB alloc)
363+ - AppendOnly: 8.05 ms (1.96 MB)
364+ - SQLite: 4.62 ms (0.89 MB)
365+ - LiteDB: 7.73 ms (15.99 MB)
366+ - SCDB Dir (unencrypted): 7.69 ms (1.94 MB)
367+ - SCDB Dir (encrypted): 8.50 ms (1.94 MB)
368+ - SCDB Single (unencrypted): 13.41 ms (7.16 MB)
369+ - SCDB Single (encrypted): 13.74 ms (7.16 MB)
370+
371+ ### Select (WHERE age > 30, with idx_age)
372+ - PageBased: 1.52 ms (2.21 MB)
373+ - AppendOnly: 2.10 ms (1.91 MB)
374+ - SCDB Dir (unencrypted): 1.55 ms (2.21 MB)
375+ - SCDB Dir (encrypted): 1.53 ms (2.21 MB)
376+ - SCDB Single (unencrypted): 7.23 µs (4.9 KB)
377+ - SCDB Single (encrypted): 7.21 µs (4.9 KB)
378+
379+ ### Update (500 random rows)
380+ - PageBased: 7.44 ms (2.78 MB)
381+ - SCDB Dir (unencrypted): 7.41 ms (2.78 MB)
382+ - SCDB Dir (encrypted): 7.46 ms (2.79 MB)
383+ - SCDB Single (unencrypted): 7.86 ms (4.38 MB)
384+ - SCDB Single (encrypted): 8.05 ms (4.38 MB)
385+ - SQLite: 0.58 ms (193 KB)
386+ - AppendOnly: 366.51 ms (heavy GC, not suited for UPDATE)
387+ - LiteDB: 35.29 ms (25.34 MB)
388+
389+ ### Analytics (SUM/AVG)
390+ - Columnar SIMD: ~ 0.043 ns (micro-measure)
391+ - SQLite: 325.81 µs (714 B)
392+ - LiteDB: 7.84 ms (10.68 MB)
393+
394+ ## Comparison vs LiteDB
395+ - Insert (1K): SharpCoreDB PageBased ~ 7.63 ms vs LiteDB ~ 7.73 ms (near parity).
396+ - Update (500): SharpCoreDB ~ 7.4–8.0 ms vs LiteDB ~ 35.3 ms (~ 4.5x faster).
397+ - Select: SCDB Single ~ 7.2 µs (mmap), directory/page ~ 1.5 ms; LiteDB not measured here.
398+ - Analytics: Columnar SIMD >> LiteDB (µs vs ms).
399+
400+ ## Use Cases & Ideal Settings
401+ See ` docs/UseCases.md ` for quick-start settings per scenario:
402+ - Web App (Concurrent Reads + OLTP Writes)
403+ - Reporting / Read-Heavy API
404+ - Bulk Import (ETL)
405+ - Analytics / BI
406+ - Desktop App (Single-User)
407+ - High-Concurrency API (Writes)
408+
409+ ## Tuning Recommendations
410+ - Single-file inserts:
411+ - WalBufferSizePages=4096
412+ - FileShareMode=None (exclusive)
413+ - EnableMemoryMapping=true
414+ - Disable encryption for perf runs when acceptable
415+ - Directory/Page configs:
416+ - EnablePageCache=true; PageCacheCapacity≥20000
417+ - UseGroupCommitWal=true; WalMaxBatchDelayMs≈5–10
418+ - Keep ` CREATE INDEX idx_age ON bench_records(age) ` for select tests
419+
420+ ## Notes
421+ - AppendOnly engine is optimized for insert/append; avoid UPDATE benchmarks.
422+ - Single-file SELECT benefits from memory-mapped I/O with very low allocations.
423+
424+ For full logs, see ` tests/SharpCoreDB.Benchmarks/BenchmarkDotNet.Artifacts/results/ ` .
425+
0 commit comments