mirror of
https://gitlab.com/cznic/sqlite.git
synced 2025-07-12 00:18:55 +00:00
Benchmarks
Generally, benchmarks are conducted against CGo implementation of SQLite (https://github.com/mattn/go-sqlite3).
Doing benchmarks with go test command
go test -bench . -run '^$'
Doing benchmarks with alternative runner to plot results
go test -v .
Dark color scheme:
go test -v . -dark
My results:
Insert
On disk | In memory |
---|---|
![]() |
![]() |
Select
On disk | In memory |
---|---|
![]() |
![]() |
Adding benchmarks
A specific type of benchmark function is currently automated:
type bechmarkOfNRows func(b *testing.B, db *sql.DB, nRows int)
You can implement benchmark functions of that type, then add them into allBenchmarksOfNRows
variable (see benchmarks.go)
var allBenchmarksOfNRows = []bechmarkOfNRows{
benchmarkInsert,
benchmarkSelect,
}
Elements of allBenchmarksOfNRows
will be automatically evaluated and plotted when alternative runner is used.
To make implemented benchmark available via go-test, you may write a simple stub like following (see bench_test.go):
func BenchmarkSelect(b *testing.B) {
doBenchmarkOfNrows(b, benchmarkSelect)
}