benchmarks/

directory
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT

README

Gombit benchmarks

Reproducible benchmark suite for BENCH-1 (issue #141). Full plan: docs/plans/BENCH-1-benchmark-suite.md.

What's here today

benchmarks/
└── micro/              Go abstraction-overhead microbenchmarks (Phase 2)
    ├── scenario/        shared resource types, Huma route registration, correctness assertions
    ├── nethttp/         net/http row (no router, no framework)
    ├── gin/             idiomatic plain-Gin row
    ├── huma/            bare Huma-over-Gin row
    └── gombit/           full framework.App row

Everything else in the suite's target layout (apps/, workloads/, scripts/, config/, results/, docs/methodology.md, compose.yml, Makefile) is scoped to later phases of the plan above and doesn't exist yet.

Running the framework-tax matrix

go test ./benchmarks/micro/... -bench=BenchmarkFrameworkTax -benchmem -count=10

Each row (nethttp, gin, huma, gombit) is its own package, so go test runs each as its own process. That's required, not incidental: constructing a framework.App (the gombit row) calls contract.Install, which replaces Huma's process-global huma.NewError for the rest of that process — see micro/gombit/gombit.go's doc comment.

Every row's TestScenarios checks the same four scenarios (plaintext, JSON, path parameter, validated POST) structurally before it's trusted for benchmarking — see micro/scenario/assert.go.

Relationship to the M0-2 spike

This matrix supersedes internal/contractspike's two-stack M0-2 spike benchmark as the canonical, ongoing framework-tax measurement, but does not modify or depend on it — that package's widget routes, tests, and committed openapi.json are historical and untouched. See docs/spikes/M0-2_HUMA_GIN_SPIKE.md.

Directories

Path Synopsis
micro
gin
Package gin is the idiomatic plain-Gin row of the BENCH-1 framework-tax microbenchmark matrix (issue #141): Gin routing and binding-tag validation, no Huma, no Gombit framework.
Package gin is the idiomatic plain-Gin row of the BENCH-1 framework-tax microbenchmark matrix (issue #141): Gin routing and binding-tag validation, no Huma, no Gombit framework.
gombit
Package gombit is the Gombit-runtime row of the BENCH-1 framework-tax microbenchmark matrix (issue #141): the same four scenarios as benchmarks/micro/huma, but registered through a real framework.App instead of bare Huma+Gin (scenario.RegisterEnvelopedRoutes instead of scenario.RegisterRoutes — Gombit wraps responses in the D10 envelope, which bare Huma+Gin does not do by default), so the delta between the two rows isolates the cost of the Gombit runtime itself — request-id, security headers, XSS sanitization, D10 error mapping and envelope — on top of Huma.
Package gombit is the Gombit-runtime row of the BENCH-1 framework-tax microbenchmark matrix (issue #141): the same four scenarios as benchmarks/micro/huma, but registered through a real framework.App instead of bare Huma+Gin (scenario.RegisterEnvelopedRoutes instead of scenario.RegisterRoutes — Gombit wraps responses in the D10 envelope, which bare Huma+Gin does not do by default), so the delta between the two rows isolates the cost of the Gombit runtime itself — request-id, security headers, XSS sanitization, D10 error mapping and envelope — on top of Huma.
huma
Package huma is the bare Huma-over-Gin row of the BENCH-1 framework-tax microbenchmark matrix (issue #141): Huma's typed handlers, validation, and OpenAPI emission on top of Gin, without the Gombit runtime around it and without the D10 response envelope (that's a Gombit convention, not a Huma default).
Package huma is the bare Huma-over-Gin row of the BENCH-1 framework-tax microbenchmark matrix (issue #141): Huma's typed handlers, validation, and OpenAPI emission on top of Gin, without the Gombit runtime around it and without the D10 response envelope (that's a Gombit convention, not a Huma default).
nethttp
Package nethttp is the plain net/http row of the BENCH-1 framework-tax microbenchmark matrix (issue #141): no router, no framework, hand-written JSON encode/decode and manual validation.
Package nethttp is the plain net/http row of the BENCH-1 framework-tax microbenchmark matrix (issue #141): no router, no framework, hand-written JSON encode/decode and manual validation.
scenario
Package scenario defines the five request/response scenarios shared by every row of the BENCH-1 framework-tax microbenchmark matrix (issue #141 "1.
Package scenario defines the five request/response scenarios shared by every row of the BENCH-1 framework-tax microbenchmark matrix (issue #141 "1.

Jump to

Keyboard shortcuts

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