MCPcopy Create free account
hub / github.com/go-dev-frame/sponge / BenchmarkMsgpack

Function BenchmarkMsgpack

pkg/encoding/encoding_test.go:195–213  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

193}
194
195func BenchmarkMsgpack(b *testing.B) {
196 // run the Fib function b.N times
197 a := make([]int, 400)
198 for i := 0; i < 400; i++ {
199 a = append(a, i)
200 }
201 msgPackEncoding := MsgPackEncoding{}
202 data, err := msgPackEncoding.Marshal(a)
203 if err != nil {
204 b.Error(err)
205 }
206 var result []int
207 for n := 0; n < b.N; n++ {
208 err = msgPackEncoding.Unmarshal(data, &result)
209 if err != nil {
210 b.Error(err)
211 }
212 }
213}

Callers

nothing calls this directly

Calls 3

MarshalMethod · 0.95
UnmarshalMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected