Benchmarks
Running
task benchmark # Standard Go benchmarks (pglike/SQLite, :memory:)
task testBenchmark # Standalone PG benchmarks (starts/stops Podman container)
Structure
benchmark_test.go # Standard Go benchmarks (in-process, :memory:)
cmd/bench-*/ # Standalone programs for real PostgreSQL
benchmarks/
<name>/ # One directory per benchmark topic
purpose.md # User-authored test objectives
analysis.md # Findings and recommendations
summary.md # AI-generated executive summary (optional)
results.md # Complete report with data tables (generated by bench run)
Each benchmark directory is rendered to a single HTML page by task docs.
Writing Benchmarks
- Use
:memory: for in-process benchmarks (no disk I/O noise)
b.ResetTimer() after setup
- Sub-benchmarks (
b.Run(...)) to vary parameters
l.EnsureInterestAccounts() during setup for interest-related benchmarks
- Standalone PG benchmarks go in
cmd/bench-*, wired into task testBenchmark
Benchmark Index
In-process (pglike/SQLite)
| Benchmark |
What it measures |
TPS |
BenchmarkRecordMovement |
Single movement insert |
~2,318 |
BenchmarkBalanceQuery |
Balance query vs movement count (100/1k/10k) |
— |
BenchmarkSimpleMovementAndBalance |
Movement + Balance per op (baseline) |
~1,260 |
BenchmarkCompoundMovementWithProjections |
Compound: movement + interest + live balance |
~586 |
BenchmarkInterestNAccounts |
RunDailyInterest scaling (10/100/1k/10k accounts) |
— |
Standalone (real PostgreSQL)
| Benchmark |
What it measures |
Analysis |
bench-balance-types |
BIGINT vs DOUBLE vs NUMERIC for point-in-time lookup |
balance-types |
bench-compound-movements |
Simple vs compound movement throughput |
compound-movements |
bench-scv |
Single Customer View generation |
scv |
bench-api |
Direct library calls vs HTTP API |
ledger-backends |
Research
| Topic |
What it covers |
Document |
| Numbers |
Go decimal/money library comparison for amount representation |
numbers |
| Interest |
Daily interest calculation design: AER, day-count, rounding, integer formula |
interest |
| AER |
UK AER regulation, formulae, rounding rules, and worked examples |
aer |