MCPcopy
hub / github.com/gofiber/fiber / Benchmark_Router_NotFound_Parallel

Function Benchmark_Router_NotFound_Parallel

router_test.go:2129–2147  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

2127}
2128
2129func Benchmark_Router_NotFound_Parallel(b *testing.B) {
2130 b.ReportAllocs()
2131 app := New()
2132 app.Use(func(c Ctx) error {
2133 return c.Next()
2134 })
2135 registerDummyRoutes(app)
2136 appHandler := app.Handler()
2137 c := &fasthttp.RequestCtx{}
2138 c.Request.Header.SetMethod("DELETE")
2139 c.URI().SetPath("/this/route/does/not/exist")
2140 b.RunParallel(func(pb *testing.PB) {
2141 for pb.Next() {
2142 appHandler(c)
2143 }
2144 })
2145 require.Equal(b, 404, c.Response.StatusCode())
2146 require.Equal(b, "Not Found", string(c.Response.Body()))
2147}
2148
2149func Benchmark_Router_Handler_Parallel(b *testing.B) {
2150 app := New()

Callers

nothing calls this directly

Calls 10

registerDummyRoutesFunction · 0.85
HandlerMethod · 0.80
SetMethodMethod · 0.80
SetPathMethod · 0.80
URIMethod · 0.80
NewFunction · 0.70
UseMethod · 0.65
NextMethod · 0.65
BodyMethod · 0.65
StatusCodeMethod · 0.45

Tested by

no test coverage detected