Home / Function/ Benchmark_Msgpack_Binding_Bind() — fiber Function Reference

Benchmark_Msgpack_Binding_Bind() — fiber Function Reference

Architecture documentation for the Benchmark_Msgpack_Binding_Bind() function in msgpack_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  fb702c89_52cc_543c_29cc_c84f284d9fc3["Benchmark_Msgpack_Binding_Bind()"]
  7fad0068_48d2_1c8d_0423_cf4802872c93["msgpack_test.go"]
  fb702c89_52cc_543c_29cc_c84f284d9fc3 -->|defined in| 7fad0068_48d2_1c8d_0423_cf4802872c93
  style fb702c89_52cc_543c_29cc_c84f284d9fc3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binder/msgpack_test.go lines 55–87

func Benchmark_Msgpack_Binding_Bind(b *testing.B) {
	b.ReportAllocs()

	binder := &MsgPackBinding{
		MsgPackDecoder: msgpack.Unmarshal,
	}

	type User struct {
		Name  string   `msgpack:"name"`
		Posts []string `msgpack:"posts"`
		Age   int      `msgpack:"age"`
	}

	var user User
	var err error
	for b.Loop() {
		// {"name":"john","age":42,"posts":[{"title":"post1"},{"title":"post2"},{"title":"post3"}]}
		err = binder.Bind([]byte{
			0x83, 0xa4, 0x6e, 0x61, 0x6d, 0x65, 0xa4, 0x6a, 0x6f, 0x68, 0x6e, 0xa3, 0x61, 0x67, 0x65, 0x2a,
			0xa5, 0x70, 0x6f, 0x73, 0x74, 0x73, 0x93, 0xa5, 0x70, 0x6f, 0x73, 0x74, 0x31, 0xa5, 0x70, 0x6f,
			0x73, 0x74, 0x32, 0xa5, 0x70, 0x6f, 0x73, 0x74, 0x33,
		},
			&user)
	}

	require.NoError(b, err)
	require.Equal(b, "john", user.Name)
	require.Equal(b, 42, user.Age)
	require.Len(b, user.Posts, 3)
	require.Equal(b, "post1", user.Posts[0])
	require.Equal(b, "post2", user.Posts[1])
	require.Equal(b, "post3", user.Posts[2])
}

Domain

Subdomains

Frequently Asked Questions

What does Benchmark_Msgpack_Binding_Bind() do?
Benchmark_Msgpack_Binding_Bind() is a function in the fiber codebase, defined in binder/msgpack_test.go.
Where is Benchmark_Msgpack_Binding_Bind() defined?
Benchmark_Msgpack_Binding_Bind() is defined in binder/msgpack_test.go at line 55.

Analyze Your Own Codebase

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

Try Supermodel Free