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

Function Benchmark_Router_Chain

router_test.go:1587–1603  ·  view source on GitHub ↗

go test -v ./... -run=^$ -bench=Benchmark_Router_Chain -benchmem -count=4

(b *testing.B)

Source from the content-addressed store, hash-verified

1585
1586// go test -v ./... -run=^$ -bench=Benchmark_Router_Chain -benchmem -count=4
1587func Benchmark_Router_Chain(b *testing.B) {
1588 app := New()
1589 handler := func(c Ctx) error {
1590 return c.Next()
1591 }
1592 app.Get("/", handler, handler, handler, handler, handler, handler)
1593
1594 appHandler := app.Handler()
1595
1596 c := &fasthttp.RequestCtx{}
1597
1598 c.Request.Header.SetMethod(MethodGet)
1599 c.URI().SetPath("/")
1600 for b.Loop() {
1601 appHandler(c)
1602 }
1603}
1604
1605// go test -v ./... -run=^$ -bench=Benchmark_Router_WithCompression -benchmem -count=4
1606func Benchmark_Router_WithCompression(b *testing.B) {

Callers

nothing calls this directly

Calls 7

HandlerMethod · 0.80
SetMethodMethod · 0.80
SetPathMethod · 0.80
URIMethod · 0.80
NewFunction · 0.70
NextMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected