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

Function Benchmark_Communication_Flow

app_test.go:3291–3312  ·  view source on GitHub ↗

go test -v -run=^$ -bench=Benchmark_Communication_Flow -benchmem -count=4

(b *testing.B)

Source from the content-addressed store, hash-verified

3289
3290// go test -v -run=^$ -bench=Benchmark_Communication_Flow -benchmem -count=4
3291func Benchmark_Communication_Flow(b *testing.B) {
3292 app := New()
3293
3294 app.Get("/", func(c Ctx) error {
3295 return c.SendString("Hello, World!")
3296 })
3297
3298 h := app.Handler()
3299
3300 fctx := &fasthttp.RequestCtx{}
3301 fctx.Request.Header.SetMethod(MethodGet)
3302 fctx.Request.SetRequestURI("/")
3303
3304 b.ReportAllocs()
3305
3306 for b.Loop() {
3307 h(fctx)
3308 }
3309
3310 require.Equal(b, 200, fctx.Response.Header.StatusCode())
3311 require.Equal(b, "Hello, World!", string(fctx.Response.Body()))
3312}
3313
3314func Benchmark_Communication_Flow_Parallel(b *testing.B) {
3315 app := New()

Callers

nothing calls this directly

Calls 7

HandlerMethod · 0.80
SetMethodMethod · 0.80
NewFunction · 0.70
GetMethod · 0.65
SendStringMethod · 0.65
BodyMethod · 0.65
StatusCodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…