finds.dev← search

// the find

julienschmidt/go-http-routing-benchmark

★ 1,658 · Go · BSD-3-Clause · updated Sep 2023

Go HTTP request router and web framework benchmark

A benchmark suite comparing Go HTTP router performance across real-world API shapes (GitHub's 203 routes, Parse's 26, Google+'s 13). Written by the httprouter author, so take the framing with some skepticism — but the raw numbers are reproducible and the methodology is sound enough to be useful when choosing a router.

HttpRouter's radix-tree approach genuinely dominates: 139ns vs 2665ns for Gorilla Mux on a single param route, with 1 allocation vs 7. The benchmark uses real API route shapes instead of synthetic toy routes, which makes the results more actionable. Memory consumption table is a nice addition — shows Gorilla's 1.5MB for GitHub routes vs HttpRouter's 44KB, which matters if you're running many services. The `go test -bench` approach means results are reproducible on any machine.

Benchmarks were run on Go 1.3 (2014) on a Sandy Bridge CPU — that's 12+ years stale. The Go runtime's escape analysis, GC, and compiler have changed substantially; allocation counts and ns/op numbers would look different today. Most of the tested routers are abandoned or have been superseded (go-json-rest, Traffic, Kocha, Possum), so this is a historical artifact more than a current decision tool. Chi, Gin, Echo, and Fiber — the routers people actually use in 2024 — aren't here at all. The repo's last push was 2023 but no new benchmarks were added, just dependency maintenance.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →