diff --git a/router_test.go b/router_test.go index 4832c1af..0a40ee3c 100644 --- a/router_test.go +++ b/router_test.go @@ -346,6 +346,29 @@ func Benchmark_Router_Chain(b *testing.B) { } } +// go test -v ./... -run=^$ -bench=Benchmark_Router_Compress -benchmem -count=4 +func Benchmark_Router_Compress(b *testing.B) { + app := New() + handler := func(c *Ctx) { + c.Next() + } + app.Get("/", handler) + app.Get("/", handler) + app.Get("/", handler) + app.Get("/", handler) + app.Get("/", handler) + app.Get("/", handler) + + c := &fasthttp.RequestCtx{} + + c.Request.Header.SetMethod("GET") + c.URI().SetPath("/") + + for n := 0; n < b.N; n++ { + app.handler(c) + } +} + // go test -v ./... -run=^$ -bench=Benchmark_Router_Next -benchmem -count=4 func Benchmark_Router_Next(b *testing.B) { app := New()