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

Function Benchmark_Bind_RespHeader_Map

bind_test.go:1249–1267  ·  view source on GitHub ↗

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

(b *testing.B)

Source from the content-addressed store, hash-verified

1247
1248// go test -v -run=^$ -bench=Benchmark_Bind_RespHeader_Map -benchmem -count=4
1249func Benchmark_Bind_RespHeader_Map(b *testing.B) {
1250 var err error
1251 app := New()
1252 c := app.AcquireCtx(&fasthttp.RequestCtx{})
1253
1254 c.Request().SetBody([]byte(``))
1255 c.Request().Header.SetContentType("")
1256
1257 c.Response().Header.Add("id", "1")
1258 c.Response().Header.Add("Name", "John Doe")
1259 c.Response().Header.Add("Hobby", "golang,fiber")
1260
1261 q := make(map[string][]string)
1262 b.ReportAllocs()
1263 for b.Loop() {
1264 err = c.Bind().RespHeader(&q)
1265 }
1266 require.NoError(b, err)
1267}
1268
1269// go test -run Test_Bind_Body_Compression
1270func Test_Bind_Body(t *testing.T) {

Callers

nothing calls this directly

Calls 7

AcquireCtxMethod · 0.80
RespHeaderMethod · 0.80
NewFunction · 0.70
RequestMethod · 0.65
AddMethod · 0.65
ResponseMethod · 0.65
BindMethod · 0.65

Tested by

no test coverage detected