Example repository demonstrating how to benchmark a Gin HTTP API with CodSpeed.
# Install dependencies
go mod tidy
# Run the server
go run api.go
The API will be available at http://localhost:8080
with these endpoints:
GET /albums
- List all albumsGET /albums/:id
- Get album by IDPOST /albums
- Create a new album
# Run all benchmarks
go test -bench=.
# Run with longer benchmark time for more accurate results
go test -bench=. -benchtime=5s
The repository uses GitHub Actions with CodSpeed to:
- Run benchmarks on every pull request using
codspeed-macro
runners - Track performance changes over time
- Automatically comment on PRs with performance impact
See the full guide for implementation details.