MCPcopy Create free account
hub / github.com/frain-dev/convoy / BenchmarkEncodeMsgPack

Function BenchmarkEncodeMsgPack

pkg/msgpack/msgpack_test.go:148–164  ·  view source on GitHub ↗

BenchmarkEncodeMsgPack benchmarks encoding performance

(b *testing.B)

Source from the content-addressed store, hash-verified

146
147// BenchmarkEncodeMsgPack benchmarks encoding performance
148func BenchmarkEncodeMsgPack(b *testing.B) {
149 type payload struct {
150 Data string `json:"data"`
151 }
152
153 p := payload{
154 Data: string(bytes.Repeat([]byte("x"), 10*1024)), // 10KB payload
155 }
156
157 b.ResetTimer()
158 for i := 0; i < b.N; i++ {
159 _, err := EncodeMsgPack(p)
160 if err != nil {
161 b.Fatal(err)
162 }
163 }
164}
165
166// BenchmarkEncodeMsgPackLarge benchmarks encoding with large payloads (similar to production)
167func BenchmarkEncodeMsgPackLarge(b *testing.B) {

Callers

nothing calls this directly

Calls 2

EncodeMsgPackFunction · 0.85
FatalMethod · 0.65

Tested by

no test coverage detected