Skip to content
 
 

Repository files navigation

Go ORM Benchmarks

Go Reference

Advanced benchmarks for Go ORMs and database libraries. Originally forked from orm-benchmark.

ORMs

All package run in no-cache mode.

See go.mod for their latest versions.

Run

# install
go install github.com/efectn/go-orm-benchmarks@latest
# all
go-orm-benchmarks -orm=all
# portion
go-orm-benchmarks -orm=gorm
go-orm-benchmarks -orm=pg
go-orm-benchmarks -orm=bun
# ... and so on...

Note: Also, you can run ./run_benchmarks.sh and you can get output like results.md format.

Benchmark contract

The tables are created once and truncated before every calibration run. Each iteration performs one logical operation; bulk operations process exactly 100 rows. Setup and validation are excluded from the measured interval. Reads must materialize exactly one or 100 rows, while persisted row counts and counter sentinels are checked centrally after each run. Central validation treats primary-key values as opaque and never asserts a specific ID; adapters use the key returned by their native setup path.

Insert benchmarks do not explicitly request a returned row unless the library's normal insert API intrinsically returns or populates a key. Update benchmarks do not reload the updated row. For bulk inserts, each adapter uses its idiomatic bulk API: pgx, pgx_pool, and sqlc intentionally use PostgreSQL COPY, while adapters whose bulk API emits INSERT ... VALUES retain that strategy. This difference is considered part of the library abstraction being measured.

Results

Look at results.md to see detailed benchmark results.

Note: All results are automatically generated by Github Actions. Benchmark results may sometimes be wrong.

License

go-orm-benchmarks is licensed under the terms of the MIT License (see LICENSE).

About

Advanced benchmarks for +15 Go ORMs.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages