BenchmarkEncodeMsgPack benchmarks encoding performance
(b *testing.B)
| 146 | |
| 147 | // BenchmarkEncodeMsgPack benchmarks encoding performance |
| 148 | func 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) |
| 167 | func BenchmarkEncodeMsgPackLarge(b *testing.B) { |
nothing calls this directly
no test coverage detected