Home / Function/ Benchmark_Bind_Body_MsgPack() — fiber Function Reference

Benchmark_Bind_Body_MsgPack() — fiber Function Reference

Architecture documentation for the Benchmark_Bind_Body_MsgPack() function in bind_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  097e53f8_6227_65bc_545b_b34b2807188a["Benchmark_Bind_Body_MsgPack()"]
  55065b01_f5dc_4e53_5a74_5ecc7aca8f52["bind_test.go"]
  097e53f8_6227_65bc_545b_b34b2807188a -->|defined in| 55065b01_f5dc_4e53_5a74_5ecc7aca8f52
  style 097e53f8_6227_65bc_545b_b34b2807188a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

bind_test.go lines 1179–1208

func Benchmark_Bind_Body_MsgPack(b *testing.B) {
	var err error

	app := New(
		Config{
			MsgPackEncoder: msgpack.Marshal,
			MsgPackDecoder: msgpack.Unmarshal,
			CBOREncoder:    cbor.Marshal,
			CBORDecoder:    cbor.Unmarshal,
		},
	)
	c := app.AcquireCtx(&fasthttp.RequestCtx{})

	type Demo struct {
		Name string `msgpack:"name"`
	}
	body := []byte{0x81, 0xa4, 0x6e, 0x61, 0x6d, 0x65, 0xa4, 0x6a, 0x6f, 0x68, 0x6e} // {"name":"john"}
	c.Request().SetBody(body)
	c.Request().Header.SetContentType(MIMEApplicationMsgPack)
	c.Request().Header.SetContentLength(len(body))
	d := new(Demo)

	b.ReportAllocs()

	for b.Loop() {
		err = c.Bind().Body(d)
	}
	require.NoError(b, err)
	require.Equal(b, "john", d.Name)
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Benchmark_Bind_Body_MsgPack() do?
Benchmark_Bind_Body_MsgPack() is a function in the fiber codebase, defined in bind_test.go.
Where is Benchmark_Bind_Body_MsgPack() defined?
Benchmark_Bind_Body_MsgPack() is defined in bind_test.go at line 1179.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free