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

Function Benchmark_Ctx_OverrideParam

ctx_test.go:9938–9958  ·  view source on GitHub ↗

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

(b *testing.B)

Source from the content-addressed store, hash-verified

9936
9937// go test -v -run=^$ -bench=Benchmark_Ctx_OverrideParam -benchmem -count=4
9938func Benchmark_Ctx_OverrideParam(b *testing.B) {
9939 app := New()
9940
9941 ctx := app.AcquireCtx(&fasthttp.RequestCtx{})
9942 c, ok := ctx.(*DefaultCtx)
9943 if !ok {
9944 b.Fatal("AcquireCtx did not return *DefaultCtx")
9945 }
9946
9947 defer app.ReleaseCtx(c)
9948
9949 c.values = [maxParams]string{"original", "12345"}
9950 c.route = &Route{Params: []string{"name", "id"}}
9951 c.setMatched(true)
9952
9953 b.ReportAllocs()
9954 b.ResetTimer()
9955 for b.Loop() {
9956 c.OverrideParam("name", "changed")
9957 }
9958}

Callers

nothing calls this directly

Calls 6

AcquireCtxMethod · 0.80
ReleaseCtxMethod · 0.80
NewFunction · 0.70
FatalMethod · 0.65
setMatchedMethod · 0.65
OverrideParamMethod · 0.65

Tested by

no test coverage detected