benchmarks/

directory
v1.26.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2026 License: MIT

README

Benchmarks

Standalone programs used during framework development to answer specific performance questions. Not part of the production build (go build ./cmd/... excludes this directory).

Program Question answered
bench_direct Is database/sql mutex the throughput bottleneck? (No — direct access gives <5% gain)
bench_dynamic What is the per-row overhead of the TDTP framework vs raw XML?
bench_raw Baseline: raw SQLite → custom XML with no framework, minimum possible overhead

bench_duckdb — answered, removed. Asked whether DuckDB in-memory beats modernc SQLite for the pipeline's read-heavy workload. It doesn't: three times slower end to end (database/sql crosses into cgo on every call; DuckDB's fast path is the Appender, which needs its own load path outside database/sql), no win on binary size, no win on memory. SQLite stayed the workspace engine. Numbers and method are in CLAUDE.md → "DuckDB как рабочая БД пайплайна"; the code itself (and the go-duckdb cgo dependency) was deleted once the question was settled rather than kept around unused.

Build & Run

# Build individual benchmark
go build -o /tmp/bench_direct ./benchmarks/bench_direct/
go build -o /tmp/bench_raw    ./benchmarks/bench_raw/

# Run
/tmp/bench_direct path/to/db.sqlite
/tmp/bench_raw    path/to/db.sqlite output.xml

Results (100k rows, Users table, SQLite)

Mode Time Size
bench_raw (no framework) ~380 ms 9.9 MB
bench_direct (framework) ~400 ms 9.9 MB
framework + zstd level 3 ~450 ms 2.9 MB
framework + kanzi level 6 ~700 ms 1.5 MB

Framework overhead vs raw: ~5% — negligible.

Directories

Path Synopsis
bench_direct сравнивает database/sql и прямой driver.Conn (без мьютекса) для SQLite.
bench_direct сравнивает database/sql и прямой driver.Conn (без мьютекса) для SQLite.
bench_dynamic бенчмаркирует варианты сканирования строк SQLite: interface{} vs *string.
bench_dynamic бенчмаркирует варианты сканирования строк SQLite: interface{} vs *string.
bench_raw: minimal SQLite → custom XML export, no framework overhead.
bench_raw: minimal SQLite → custom XML export, no framework overhead.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL